This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] SIGSEGV in readelf.c


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


      

Attachment: binutils-readelf.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]