Follow-up Comment #3, bug #57014 (project make):

Please have a look into src/hash.c, in sum_up_to_nul(). The memcpy() (line
416) segfaults because the bytes after \0 are not readable, in the case where
the filename (or whatever is hashed here) ends immediately (or almost
immediately) before the boundary.

I replaced 'memcpy(&val, (p), 4);' with

val = 0;
if (p[0] == 0) {
  memcpy(&val, (p), 1);
} else if (p[1] == 0) {
  memcpy(&val, (p), 2);
} else if (p[2] == 0) {
  memcpy(&val, (p), 3);
} else {
  memcpy(&val, (p), 4);
};

with success.

Another solution is to always manage 3 bytes after \0 for the hashed strings.

I suppose this sheds some (more) light on the subject.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57014>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to