From: Julian Seward Date: Thu, 22 Jul 2010 22:36:43 +0000 (+0000) Subject: pdb_ds_read: if the presented size is implausibly huge (> 512MB), X-Git-Tag: svn/VALGRIND_3_6_0~219 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4bfb6b06e6ed1ebfbbe8fa2fbd761833806389f5;p=thirdparty%2Fvalgrind.git pdb_ds_read: if the presented size is implausibly huge (> 512MB), ignore it on the assumption that the .pdb is corrupt, rather than running the system out of memory by trying to allocate a chunk of that size. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11226 --- diff --git a/coregrind/m_debuginfo/readpdb.c b/coregrind/m_debuginfo/readpdb.c index 276366a1ec..250ef6eabf 100644 --- a/coregrind/m_debuginfo/readpdb.c +++ b/coregrind/m_debuginfo/readpdb.c @@ -997,6 +997,11 @@ static void* pdb_ds_read( struct pdb_reader* pdb, UInt i; if (!size) return NULL; + if (size > 512 * 1024 * 1024) { + VG_(umsg)("Warning: pdb_ds_read: implausible size " + "(%u); skipping -- possible invalid .pdb file?\n", size); + return NULL; + } blocksize = pdb->u.ds.header->block_size; nBlocks = (size + blocksize - 1) / blocksize;