]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
pdb_ds_read: if the presented size is implausibly huge (> 512MB),
authorJulian Seward <jseward@acm.org>
Thu, 22 Jul 2010 22:36:43 +0000 (22:36 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 22 Jul 2010 22:36:43 +0000 (22:36 +0000)
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

coregrind/m_debuginfo/readpdb.c

index 276366a1ec4c6779eb5a014ef74cf4909386dc9d..250ef6eabfba0dbfc9d32c240a8f29bd1a8c6811 100644 (file)
@@ -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;