]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
VG_(addCfiSI): ignore CfiSIs which state an address range outside of
authorJulian Seward <jseward@acm.org>
Tue, 3 May 2005 15:23:00 +0000 (15:23 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 3 May 2005 15:23:00 +0000 (15:23 +0000)
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

coregrind/vg_symtab2.c

index 3efafe6ed5fa15582b4b26af793f3481759a28ad..dfd82a90bc268d6e98d3f1c4c90d1ad29dce41de 100644 (file)
@@ -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. */