[patch] SIGSEGV in readelf.c
Denis Scherbakov
denis_scherbakov@yahoo.com
Wed Apr 29 13:05:00 GMT 2009
I debugged a segmentation fault in readelf.c:5096 while reading an ia64 HP-UX 64-bit binary.
#define BYTE_GET(field) byte_get (field, sizeof (field))
tep->start.offset = BYTE_GET ((unsigned char *) tp + 0);
tep->end.offset = BYTE_GET ((unsigned char *) tp + 8);
tep->info.offset = BYTE_GET ((unsigned char *) tp + 16);
sizeof(field)=4 (size of a pointer), but we want eh_addr_size and on 64-bit systems it is 8 bytes. Fix:
tep->start.offset = byte_get ((unsigned char *) tp + 0, eh_addr_size);
tep->end.offset = byte_get ((unsigned char *) tp + 8, eh_addr_size);
tep->info.offset = byte_get ((unsigned char *) tp + 16, eh_addr_size);
Denis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: binutils-readelf.diff
Type: application/octet-stream
Size: 1188 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20090429/a58e6dd9/attachment.obj>
More information about the Binutils
mailing list