From: Nicholas Nethercote Date: Wed, 16 Mar 2005 04:09:21 +0000 (+0000) Subject: Don't try to stuff 16 bit values into 12 bit variables. X-Git-Tag: svn/VALGRIND_3_0_0~944 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f56f07bb160c129a5c7da9b7b7a18f7d2cf4b8a6;p=thirdparty%2Fvalgrind.git Don't try to stuff 16 bit values into 12 bit variables. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3374 --- diff --git a/coregrind/vg_symtab2.c b/coregrind/vg_symtab2.c index 0d6d0a2214..441d91a471 100644 --- a/coregrind/vg_symtab2.c +++ b/coregrind/vg_symtab2.c @@ -723,13 +723,13 @@ void canonicaliseLoctab ( SegInfo* si ) vg_assert(si->loctab[i].size < 10000); if (si->loctab[i].addr + si->loctab[i].size > si->loctab[i+1].addr) { /* Do this in signed int32 because the actual .size fields - are unsigned 16s. */ + are only 12 bits. */ Int new_size = si->loctab[i+1].addr - si->loctab[i].addr; if (new_size < 0) { si->loctab[i].size = 0; } else - if (new_size >= 65536) { - si->loctab[i].size = 65535; + if (new_size > MAX_LOC_SIZE) { + si->loctab[i].size = MAX_LOC_SIZE; } else { si->loctab[i].size = (UShort)new_size; }