From 2308e6fbb6f5afa20bb59ef3378fdb63de74c436 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Fri, 8 Jan 2021 13:55:40 +0100 Subject: Fix uninitialized memory read on broken files oss-fuzz/10059 --- poppler/GfxState.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc index 8a713d8c..fc411404 100644 --- a/poppler/GfxState.cc +++ b/poppler/GfxState.cc @@ -2932,6 +2932,11 @@ void GfxDeviceNColorSpace::getGray(const GfxColor *color, GfxGray *gray) const void GfxDeviceNColorSpace::getRGB(const GfxColor *color, GfxRGB *rgb) const { + if (unlikely(nComps < func->getInputSize() || alt->getNComps() > func->getOutputSize())) { + rgb->r = rgb->g = rgb->b = 0; + return; + } + double x[gfxColorMaxComps], c[gfxColorMaxComps]; GfxColor color2; int i; -- cgit v1.2.3