summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2017-06-19 23:18:51 +0200
committerAlbert Astals Cid <aacid@kde.org>2017-06-21 22:31:19 +0200
commite2ab2fa9d8c41e0115b2c276a2594cd2f7c217e6 (patch)
treefe843ee315b81d41d48eaad760e6fe3f641f8c97
parent17e4111da1ae5c9798ca0c040bf75c01bbb72a8a (diff)
Fix crash on malformed files
Bug #101500
-rw-r--r--poppler/Function.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/poppler/Function.cc b/poppler/Function.cc
index 7f359b8e..785933df 100644
--- a/poppler/Function.cc
+++ b/poppler/Function.cc
@@ -13,7 +13,7 @@
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
-// Copyright (C) 2006, 2008-2010, 2013-2015 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006, 2008-2010, 2013-2015, 2017 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2006 Jeff Muizelaar <jeff@infidigm.net>
// Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com>
// Copyright (C) 2011 Andrea Canciani <ranma42@gmail.com>
@@ -1623,7 +1623,9 @@ void PostScriptFunction::exec(PSStack *stack, int codePtr) {
case psOpIdiv:
i2 = stack->popInt();
i1 = stack->popInt();
- stack->pushInt(i1 / i2);
+ if (likely(i2 != 0)) {
+ stack->pushInt(i1 / i2);
+ }
break;
case psOpIndex:
stack->index(stack->popInt());
@@ -1659,7 +1661,9 @@ void PostScriptFunction::exec(PSStack *stack, int codePtr) {
case psOpMod:
i2 = stack->popInt();
i1 = stack->popInt();
- stack->pushInt(i1 % i2);
+ if (likely(i2 != 0)) {
+ stack->pushInt(i1 % i2);
+ }
break;
case psOpMul:
if (stack->topTwoAreInts()) {