Segmentation Fault
Status: Beta
Brought to you by:
mattgiuca
Using diffh caused me to cause a segmentation fault with the following error output.
localhost:~/Desktop/schemacrawler-5.5-distrib/schemacrawler uto$ diff -u venkatdb.txt venkatdb_new.txt | diffh > diffh.html
diffh(1940) malloc: *** error for object 0x302250: incorrect checksum for freed object - object was probably modified after being freed, break at szone_error to debug
diffh(1940) malloc: *** set a breakpoint in szone_error to debug
Segmentation fault
Logged In: YES
user_id=1790121
Originator: NO
I had a segfault too. I entered gdb, found the segfault at output.c:158. Looked at the code, and the malloc_size determination was broken (ie the new size was > 2x the old size). The fix worked for me, see below.
JimQ
>> /usr/bin/diff output.c~ output.c
355,356c355,360
< if (retsize_new+1 >= malloc_size)
< ret = realloc(ret, (malloc_size*=2) * sizeof(char));
---
> if (retsize_new+1 >= malloc_size) {
> do {
> malloc_size*=2;
> } while (retsize_new+1 >= malloc_size);
> ret = realloc(ret, malloc_size * sizeof(char));
> }
363c367,370
< if (retsize_new+1 >= malloc_size)
---
> if (retsize_new+1 >= malloc_size) {
> do {
> malloc_size*=2;
> } while (retsize_new+1 >= malloc_size);
364a372
> }