segfault in file-4.17
Christos Zoulas
christos at zoulas.com
Tue Mar 14 01:50:20 EET 2006
On Mar 13, 6:40pm, vapier at gentoo.org (Mike Frysinger) wrote:
-- Subject: segfault in file-4.17
| seems i missed this in the earlier request for testing since i only tested
| amd64, sorry :/
|
| on Gentoo/x86 systems, a bunch of users have been hitting segfaults when
| compiling the magic files during build (Bug 126012):
| ../src/file -C -m magic
| make[2]: *** [magic.mgc] Segmentation fault
|
| the crash appears to be in libmagic.so as using `file` 4.16 but libgmagic.so
| from 4.17 also crashes ... looking through the 4.16 and 4.17 diff, i noticed
| this change in the apprentice_file() func in src/apprentice.c:
| maxmagic = MAXMAGIS;
| - *magicp = (struct magic *) calloc(maxmagic, sizeof(struct magic));
| - if (*magicp == NULL) {
| + if ((marray = malloc(maxmagic * sizeof(*marray))) == NULL) {
| (void)fclose(f);
|
| i dont know whether this change was on purpose, but reverting it does fix the
| crash for me ... in the attached patch, i also removed an unused variable
| -mike
|
Thanks, I see the problem now. I have fixed it as you suggested.
christos
More information about the File
mailing list