diff options
author | ntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2008-03-07 16:38:02 +0000 |
---|---|---|
committer | ntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2008-03-07 16:38:02 +0000 |
commit | 984e9f0e4435afdd24edd3d83dff0145a2613821 (patch) | |
tree | 6663e172f525069755441d4efa07a361008e7276 | |
parent | d3f3f6149867c6ccd5d10ac469df1d7af95cbf19 (diff) | |
download | openocd_libswd-984e9f0e4435afdd24edd3d83dff0145a2613821.tar.gz openocd_libswd-984e9f0e4435afdd24edd3d83dff0145a2613821.tar.bz2 openocd_libswd-984e9f0e4435afdd24edd3d83dff0145a2613821.tar.xz openocd_libswd-984e9f0e4435afdd24edd3d83dff0145a2613821.zip |
- The elf loader incorrectly assumed that the program header always follows the ELF header. (Thanks Michael Bruck)
git-svn-id: svn://svn.berlios.de/openocd/trunk@472 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r-- | src/target/image.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/target/image.c b/src/target/image.c index 3fac0571..39df4aef 100644 --- a/src/target/image.c +++ b/src/target/image.c @@ -381,6 +381,14 @@ int image_elf_read_headers(image_t *image) return ERROR_IMAGE_FORMAT_ERROR; } + + if ((retval = fileio_seek(&elf->fileio, elf->header->e_phoff)) != ERROR_OK) + { + ERROR("cannot seek to ELF program header table, read failed"); + return retval; + } + + elf->segments = malloc(elf->segment_count*sizeof(Elf32_Phdr)); if ((retval = fileio_read(&elf->fileio, elf->segment_count*sizeof(Elf32_Phdr), (u8*)elf->segments, &read_bytes)) != ERROR_OK) @@ -1001,3 +1009,4 @@ int image_calculate_checksum(u8* buffer, u32 nbytes, u32* checksum) return ERROR_OK; } + |