|
From: <sv...@va...> - 2012-09-02 20:48:11
|
sewardj 2012-09-02 21:48:03 +0100 (Sun, 02 Sep 2012)
New Revision: 12941
Log:
Merge from trunk, r12891 (Fix up range checking in ML_(addLineInfo),
#304980)
Modified directories:
branches/VALGRIND_3_8_BRANCH/
branches/VALGRIND_3_8_BRANCH/coregrind/
branches/VALGRIND_3_8_BRANCH/coregrind/m_syswrap/
Modified files:
branches/VALGRIND_3_8_BRANCH/coregrind/m_debuginfo/storage.c
branches/VALGRIND_3_8_BRANCH/coregrind/m_syswrap/syswrap-generic.c
Modified: branches/VALGRIND_3_8_BRANCH/
Modified: branches/VALGRIND_3_8_BRANCH/coregrind/
Modified: branches/VALGRIND_3_8_BRANCH/coregrind/m_syswrap/
Property changed: branches/VALGRIND_3_8_BRANCH/coregrind (+0 -0)
___________________________________________________________________
Name: svn:mergeinfo
- /branches/TCHAIN/coregrind:12477-12516
/trunk/coregrind:12873,12881,12885,12887
+ /branches/TCHAIN/coregrind:12477-12516
/trunk/coregrind:12873,12881,12885,12887,12891
Modified: branches/VALGRIND_3_8_BRANCH/coregrind/m_debuginfo/storage.c (+13 -5)
===================================================================
--- branches/VALGRIND_3_8_BRANCH/coregrind/m_debuginfo/storage.c 2012-09-02 21:31:39 +01:00 (rev 12940)
+++ branches/VALGRIND_3_8_BRANCH/coregrind/m_debuginfo/storage.c 2012-09-02 21:48:03 +01:00 (rev 12941)
@@ -347,7 +347,7 @@
{
static const Bool debug = False;
DiLoc loc;
- Int size = next - this;
+ UWord size = next - this;
/* Ignore zero-sized locs */
if (this == next) return;
@@ -377,22 +377,30 @@
if (0)
VG_(message)(Vg_DebugMsg,
"warning: line info address range too large "
- "at entry %d: %d\n", entry, size);
+ "at entry %d: %lu\n", entry, size);
size = 1;
}
+ /* At this point, we know that the original value for |size|, viz
+ |next - this|, will only still be used in the case where
+ |this| <u |next|, so it can't have underflowed. Considering
+ that and the three checks that follow it, the following must
+ hold. */
+ vg_assert(size >= 1);
+ vg_assert(size <= MAX_LOC_SIZE);
+
/* Rule out ones which are completely outside the r-x mapped area.
See "Comment_Regarding_Text_Range_Checks" elsewhere in this file
for background and rationale. */
vg_assert(di->fsm.have_rx_map && di->fsm.have_rw_map);
- if (ML_(find_rx_mapping)(di, this, next - 1) == NULL) {
+ if (ML_(find_rx_mapping)(di, this, this + size - 1) == NULL) {
if (0)
VG_(message)(Vg_DebugMsg,
"warning: ignoring line info entry falling "
"outside current DebugInfo: %#lx %#lx %#lx %#lx\n",
di->text_avma,
di->text_avma + di->text_size,
- this, next-1);
+ this, this + size - 1);
return;
}
@@ -420,7 +428,7 @@
loc.dirname = dirname;
if (0) VG_(message)(Vg_DebugMsg,
- "addLoc: addr %#lx, size %d, line %d, file %s\n",
+ "addLoc: addr %#lx, size %lu, line %d, file %s\n",
this,size,lineno,filename);
addLoc ( di, &loc );
Property changed: branches/VALGRIND_3_8_BRANCH (+0 -0)
___________________________________________________________________
Name: svn:mergeinfo
- /branches/TCHAIN:12477-12516
/trunk:12873,12878-12879,12885,12887
+ /branches/TCHAIN:12477-12516
/trunk:12873,12878-12879,12885,12887,12891
Property changed: branches/VALGRIND_3_8_BRANCH/coregrind/m_syswrap (+0 -0)
___________________________________________________________________
Name: svn:mergeinfo
- /branches/TCHAIN/coregrind/m_syswrap:12477-12516
/trunk/coregrind/m_syswrap:12873,12881-12883,12885,12887
+ /branches/TCHAIN/coregrind/m_syswrap:12477-12516
/trunk/coregrind/m_syswrap:12873,12881-12883,12885,12887,12891
Property changed: branches/VALGRIND_3_8_BRANCH/coregrind/m_syswrap/syswrap-generic.c (+0 -0)
___________________________________________________________________
Name: svn:mergeinfo
- /branches/TCHAIN/coregrind/m_syswrap/syswrap-generic.c:12477-12516
/trunk/coregrind/m_syswrap/syswrap-generic.c:12874,12878-12879,12881-12883,12885,12887
+ /branches/TCHAIN/coregrind/m_syswrap/syswrap-generic.c:12477-12516
/trunk/coregrind/m_syswrap/syswrap-generic.c:12874,12878-12879,12881-12883,12885,12887,12891
|