[poppler] goo/gmem.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Thu May 24 10:43:31 UTC 2018
goo/gmem.cc | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
New commits:
commit ea72a3f3dc1619482ab2502dc50fe628600f38b5
Author: Albert Astals Cid <aacid at kde.org>
Date: Thu May 24 12:42:54 2018 +0200
gmallocn: move the operation after the checks
fixes oss-fuzz/8423
diff --git a/goo/gmem.cc b/goo/gmem.cc
index 46cfc653..f118fd71 100644
--- a/goo/gmem.cc
+++ b/goo/gmem.cc
@@ -178,17 +178,15 @@ void *grealloc_checkoverflow(void *p, size_t size) {
}
inline static void *gmallocn(int nObjs, int objSize, bool checkoverflow) {
- int n;
-
if (nObjs == 0) {
return nullptr;
}
- n = nObjs * objSize;
if (objSize <= 0 || nObjs < 0 || nObjs >= INT_MAX / objSize) {
fprintf(stderr, "Bogus memory allocation size\n");
if (checkoverflow) return nullptr;
else exit(1);
}
+ const int n = nObjs * objSize;
return gmalloc(n, checkoverflow);
}
More information about the poppler
mailing list