[poppler] poppler/GfxState.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Mon Jul 2 19:46:54 UTC 2018


 poppler/GfxState.cc |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 1b5298ebb8d76b5eee11d9cccdfffcdceb5d064b
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Jul 2 21:46:10 2018 +0200

    GfxUnivariateShading::getColor: Fix uninitialized memory read
    
    fixes oss-fuzz/9165

diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index f065b672..e4b08e71 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -3900,10 +3900,13 @@ GfxUnivariateShading::~GfxUnivariateShading() {
 
 int GfxUnivariateShading::getColor(double t, GfxColor *color) {
   double out[gfxColorMaxComps];
+  int nComps;
 
-  // NB: there can be one function with n outputs or n functions with
-  // one output each (where n = number of color components)
-  const int nComps = nFuncs * funcs[0]->getOutputSize();
+  if (likely(nFuncs >= 1)) {
+    // NB: there can be one function with n outputs or n functions with
+    // one output each (where n = number of color components)
+    nComps = nFuncs * funcs[0]->getOutputSize();
+  }
 
   if (unlikely(nFuncs < 1 || nComps > gfxColorMaxComps)) {
     for (int i = 0; i < gfxColorMaxComps; i++)


More information about the poppler mailing list