From: Julian Seward Date: Tue, 3 May 2005 15:23:00 +0000 (+0000) Subject: VG_(addCfiSI): ignore CfiSIs which state an address range outside of X-Git-Tag: svn/VALGRIND_3_0_0~715 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=63d43bb078679bfb80b5236d8fb0441f7182b0bd;p=thirdparty%2Fvalgrind.git VG_(addCfiSI): ignore CfiSIs which state an address range outside of the segment itself. This may well be hiding bugs in the CFI reader, but I can't figure out why some .so-s generate very low address ranges -- sometimes eg 0x0 .. 0x1. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3603 --- diff --git a/coregrind/vg_symtab2.c b/coregrind/vg_symtab2.c index 3efafe6ed5..dfd82a90bc 100644 --- a/coregrind/vg_symtab2.c +++ b/coregrind/vg_symtab2.c @@ -386,6 +386,18 @@ void VG_(addCfiSI) ( SegInfo* si, CfiSI* cfisi ) UInt new_sz, i; CfiSI* new_tab; + /* Rule out ones which are completely outside the segment. These + probably indicate some kind of bug, but for the meantime ignore + them. */ + if ( cfisi->base + cfisi->len - 1 < si->start + || si->start + si->size - 1 < cfisi->base ) { + if (VG_(clo_trace_cfi)) { + VG_(printf)("CfiSI outside segment: "); + VG_(ppCfiSI)(cfisi); + } + return; + } + if (si->cfisi_used == si->cfisi_size) { new_sz = 2 * si->cfisi_size; if (new_sz == 0) new_sz = 20; @@ -863,6 +875,13 @@ void canonicaliseCfiSI ( SegInfo* si ) <= si->cfisi_maxaddr); if (i < si->cfisi_used - 1) { + /* + if (!(si->cfisi[i].base < si->cfisi[i+1].base)) { + VG_(printf)("\nOOO cfisis:\n"); + VG_(ppCfiSI)(&si->cfisi[i]); + VG_(ppCfiSI)(&si->cfisi[i+1]); + } + */ /* In order. */ vg_assert(si->cfisi[i].base < si->cfisi[i+1].base); /* No overlaps. */