From: Nicholas Nethercote Date: Mon, 1 Dec 2003 11:54:09 +0000 (+0000) Subject: Fixed test in section finding code that was broken for .plt and .got sections. X-Git-Tag: svn/VALGRIND_2_1_0~29 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5f1bf8818f1265cc239fdb451abba494130073de;p=thirdparty%2Fvalgrind.git Fixed test in section finding code that was broken for .plt and .got sections. Thanks to Tom Hughes for the patch. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2075 --- diff --git a/coregrind/vg_symtab2.c b/coregrind/vg_symtab2.c index 6ead333f72..d89bab24e7 100644 --- a/coregrind/vg_symtab2.c +++ b/coregrind/vg_symtab2.c @@ -982,17 +982,14 @@ Bool vg_read_lib_symbols ( SegInfo* si ) if (0 == VG_(strcmp)(sec_name, sh_strtab + shdr[i].sh_name)) { \ if (0 != sec_data) \ VG_(core_panic)("repeated section!\n"); \ - if (in_exec) { \ + if (in_exec) \ sec_data = (type)(si->offset + shdr[i].sh_addr); \ - sec_size = shdr[i].sh_size; \ - } else { \ + else \ sec_data = (type)(oimage + shdr[i].sh_offset); \ - sec_size = shdr[i].sh_size; \ - } \ + sec_size = shdr[i].sh_size; \ TRACE_SYMTAB( "%18s: %p .. %p\n", \ sec_name, sec_data, sec_data + sec_size - 1); \ - if ( sec_size + (UChar*)sec_data > n_oimage + (UChar*)oimage) \ - { \ + if ( shdr[i].sh_offset + sec_size > n_oimage ) { \ VG_(symerr)(" section beyond image end?!"); \ goto out; \ } \