[poppler] poppler/GfxState.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Aug 10 10:00:43 UTC 2019


 poppler/GfxState.cc |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 2930542f667ac187533ec899280df4b0b7ed0ba9
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sat Aug 10 11:54:27 2019 +0200

    GfxPatchMeshShading::parse: Fix abort on broken files

diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index b239e273..3061abbe 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -5260,8 +5260,12 @@ GfxPatchMeshShading *GfxPatchMeshShading::parse(GfxResources *res, int typeA, Di
     if (nPatchesA == patchesSize) {
       int oldPatchesSize = patchesSize;
       patchesSize = (patchesSize == 0) ? 16 : 2 * patchesSize;
-      patchesA = (GfxPatch *)greallocn(patchesA,
+      patchesA = (GfxPatch *)greallocn_checkoverflow(patchesA,
 				       patchesSize, sizeof(GfxPatch));
+      if (unlikely(!patchesA)) {
+	for (int k = 0; k < nFuncsA; ++k) delete funcsA[k];
+	return nullptr;
+      }
       memset(patchesA + oldPatchesSize, 0, (patchesSize - oldPatchesSize) * sizeof(GfxPatch));
     }
     p = &patchesA[nPatchesA];


More information about the poppler mailing list