summaryrefslogtreecommitdiff
path: root/poppler/PSOutputDev.cc
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2021-01-04 23:39:54 +0100
committerAlbert Astals Cid <aacid@kde.org>2021-01-04 23:39:54 +0100
commite4346ae34b24ce84a4aeae539f26cab49497450c (patch)
treef57339967db2b35a565451f87e8e9131c5204591 /poppler/PSOutputDev.cc
parent9bb28091b64c1b19dcdccb63d50593abc15f627a (diff)
PSOutputDev: protect against potential divide by 0
oss-fuzz/29241
Diffstat (limited to 'poppler/PSOutputDev.cc')
-rw-r--r--poppler/PSOutputDev.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 9e88e32c..7e83c94c 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -3734,6 +3734,10 @@ void PSOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA)
xScale = xScale0;
yScale = yScale0;
} else if ((globalParams->getPSShrinkLarger() && (width > imgWidth2 || height > imgHeight2)) || (globalParams->getPSExpandSmaller() && (width < imgWidth2 && height < imgHeight2))) {
+ if (unlikely(width == 0)) {
+ error(errSyntaxError, -1, "width 0, xScale would be infinite");
+ return;
+ }
xScale = (double)imgWidth2 / (double)width;
yScale = (double)imgHeight2 / (double)height;
if (yScale < xScale) {