]> Savannah Git Hosting - gnulib.git/commitdiff
xalloc: add missing integer overflow check
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 26 Apr 2017 18:38:30 +0000 (11:38 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 26 Apr 2017 18:40:09 +0000 (11:40 -0700)
* lib/xalloc.h (x2nrealloc): Also check for multiplication
overflow when P is null.

ChangeLog
lib/xalloc.h

index 8010a24505566657f9a204ad294340860d1905d5..fd5ec8936e892d0fe76a0941658be77bf8f1fea6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-04-26  Paul Eggert  <eggert@cs.ucla.edu>
+
+       xalloc: add missing integer overflow check
+       * lib/xalloc.h (x2nrealloc): Also check for multiplication
+       overflow when P is null.
+
 2017-04-25  Paul Eggert  <eggert@cs.ucla.edu>
 
        parse-datetime: make it standalone
index 484b67f1335a1d34162c6dd3fca14e6c499c3ac8..5cf804b44d109431b0c4737371e114f71d3eac74 100644 (file)
@@ -194,6 +194,8 @@ x2nrealloc (void *p, size_t *pn, size_t s)
           n = DEFAULT_MXFAST / s;
           n += !n;
         }
+      if (xalloc_oversized (n, s))
+        xalloc_die ();
     }
   else
     {