|
|
76f8c5 |
From d9c88e1c8892c79b8865a0dabdcc0d3ffd55c195 Mon Sep 17 00:00:00 2001
|
|
|
76f8c5 |
From: Albert Astals Cid <aacid@kde.org>
|
|
|
76f8c5 |
Date: Wed, 21 Jun 2017 00:56:38 +0200
|
|
|
76f8c5 |
Subject: [PATCH] Fix crash in malformed documents
|
|
|
76f8c5 |
|
|
|
76f8c5 |
---
|
|
|
76f8c5 |
poppler/GfxState.cc | 12 ++++++------
|
|
|
76f8c5 |
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
|
76f8c5 |
|
|
|
76f8c5 |
diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
|
|
|
76f8c5 |
index e6cd329..f61f812 100644
|
|
|
76f8c5 |
--- a/poppler/GfxState.cc
|
|
|
76f8c5 |
+++ b/poppler/GfxState.cc
|
|
|
76f8c5 |
@@ -4034,18 +4034,18 @@ GfxUnivariateShading::~GfxUnivariateShading() {
|
|
|
76f8c5 |
|
|
|
76f8c5 |
void GfxUnivariateShading::getColor(double t, GfxColor *color) {
|
|
|
76f8c5 |
double out[gfxColorMaxComps];
|
|
|
76f8c5 |
- int i, nComps;
|
|
|
76f8c5 |
+ int i;
|
|
|
76f8c5 |
+
|
|
|
76f8c5 |
+ // NB: there can be one function with n outputs or n functions with
|
|
|
76f8c5 |
+ // one output each (where n = number of color components)
|
|
|
76f8c5 |
+ const int nComps = nFuncs * funcs[0]->getOutputSize();
|
|
|
76f8c5 |
|
|
|
76f8c5 |
- if (unlikely(nFuncs < 1)) {
|
|
|
76f8c5 |
+ if (unlikely(nFuncs < 1 || nComps > gfxColorMaxComps)) {
|
|
|
76f8c5 |
for (int i = 0; i < gfxColorMaxComps; i++)
|
|
|
76f8c5 |
color->c[i] = 0;
|
|
|
76f8c5 |
return;
|
|
|
76f8c5 |
}
|
|
|
76f8c5 |
|
|
|
76f8c5 |
- // NB: there can be one function with n outputs or n functions with
|
|
|
76f8c5 |
- // one output each (where n = number of color components)
|
|
|
76f8c5 |
- nComps = nFuncs * funcs[0]->getOutputSize();
|
|
|
76f8c5 |
-
|
|
|
76f8c5 |
if (cacheSize > 0) {
|
|
|
76f8c5 |
double x, ix, *l, *u, *upper;
|
|
|
76f8c5 |
|
|
|
76f8c5 |
--
|
|
|
76f8c5 |
2.9.3
|
|
|
76f8c5 |
|