summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2014-03-26 00:48:15 +0100
committerAlbert Astals Cid <aacid@kde.org>2014-03-26 00:57:22 +0100
commit9002b3b7cbbbc5802abfa8383ded2093a29d1746 (patch)
tree3db5dfb63c505e12362ba854fe4aae26958fd488
parent8947c6bc1dcb768b9d9c03a7a5db1573abdc2e87 (diff)
Fix ASAN in 784.asan.0.9671.pdf
================================================================= ==24856== ERROR: AddressSanitizer: SEGV on unknown address 0x603bfffe5804 (pc 0x7f7aa3310c6b sp 0x7fff0e656bd0 bp 0x7fff0e656e90 T0) AddressSanitizer can not provide additional info. #0 0x7f7aa3310c6a in GfxIndexedColorSpace::mapColorToBase(GfxColor*, GfxColor*) /home/tsdgeos/devel/poppler/poppler/GfxState.cc:2509 #1 0x7f7aa33110d2 in GfxIndexedColorSpace::getRGB(GfxColor*, GfxRGB*) /home/tsdgeos/devel/poppler/poppler/GfxState.cc:2529 #2 0x7f7aa3466712 in convertGfxColor(unsigned char*, SplashColorMode, GfxColorSpace*, GfxColor*) /home/tsdgeos/devel/poppler/poppler/SplashOutputDev.cc:117 #3 0x7f7aa34675a9 in SplashUnivariatePattern::getColor(int, int, unsigned char*) /home/tsdgeos/devel/poppler/poppler/SplashOutputDev.cc:215 #4 0x7f7aa348d2a2 in Splash::pipeRun(SplashPipe*) /home/tsdgeos/devel/poppler/splash/Splash.cc:363 #5 0x7f7aa34c9c29 in Splash::drawAALine(SplashPipe*, int, int, int, bool, unsigned char) /home/tsdgeos/devel/poppler/splash/Splash.cc:1537 #6 0x7f7aa34c4787 in Splash::shadedFill(SplashPath*, bool, SplashPattern*) /home/tsdgeos/devel/poppler/splash/Splash.cc:6388 #7 0x7f7aa348b65c in SplashOutputDev::univariateShadedFill(GfxState*, SplashUnivariatePattern*, double, double) /home/tsdgeos/devel/poppler/poppler/SplashOutputDev.cc:4408 #8 0x7f7aa348b93d in SplashOutputDev::radialShadedFill(GfxState*, GfxRadialShading*, double, double) /home/tsdgeos/devel/poppler/poppler/SplashOutputDev.cc:4427 #9 0x7f7aa32c7574 in Gfx::doRadialShFill(GfxRadialShading*) /home/tsdgeos/devel/poppler/poppler/Gfx.cc:3058 #10 0x7f7aa32c188f in Gfx::opShFill(Object*, int) /home/tsdgeos/devel/poppler/poppler/Gfx.cc:2476 #11 0x7f7aa32b12c6 in Gfx::execOp(Object*, Object*, int) /home/tsdgeos/devel/poppler/poppler/Gfx.cc:903 #12 0x7f7aa32b049b in Gfx::go(bool) /home/tsdgeos/devel/poppler/poppler/Gfx.cc:762 #13 0x7f7aa32b00ef in Gfx::display(Object*, bool) /home/tsdgeos/devel/poppler/poppler/Gfx.cc:728 #14 0x7f7aa3392dc9 in Page::displaySlice(OutputDev*, double, double, int, bool, bool, int, int, int, int, bool, bool (*)(void*), void*, bool (*)(Annot*, void*), void*, bool) /home/tsdgeos/devel/poppler/poppler/Page.cc:585 #15 0x7f7aa339a2f5 in PDFDoc::displayPageSlice(OutputDev*, int, double, double, int, bool, bool, bool, int, int, int, int, bool (*)(void*), void*, bool (*)(Annot*, void*), void*, bool) /home/tsdgeos/devel/poppler/poppler/PDFDoc.cc:503 #16 0x40311e in savePageSlice(PDFDoc*, SplashOutputDev*, int, int, int, int, int, double, double, char*) /home/tsdgeos/devel/poppler/utils/pdftoppm.cc:222 #17 0x404416 in main /home/tsdgeos/devel/poppler/utils/pdftoppm.cc:521 #18 0x7f7aa29baec4 (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4) #19 0x401d58 in _start (/home/tsdgeos/devel/poppler/build-debug/utils/pdftoppm+0x401d58) SUMMARY: AddressSanitizer: SEGV /home/tsdgeos/devel/poppler/poppler/GfxState.cc:2509 GfxIndexedColorSpace::mapColorToBase(GfxColor*, GfxColor*)
-rw-r--r--poppler/GfxState.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index c6f855b9..addba686 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -16,7 +16,7 @@
// Copyright (C) 2005 Kristian Høgsberg <krh@redhat.com>
// Copyright (C) 2006, 2007 Jeff Muizelaar <jeff@infidigm.net>
// Copyright (C) 2006, 2010 Carlos Garcia Campos <carlosgc@gnome.org>
-// Copyright (C) 2006-2013 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2014 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2009, 2012 Koji Otani <sho@bbr.jp>
// Copyright (C) 2009, 2011-2013 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright (C) 2009 Christian Persch <chpe@gnome.org>
@@ -2503,7 +2503,7 @@ GfxColor *GfxIndexedColorSpace::mapColorToBase(GfxColor *color,
n = base->getNComps();
base->getDefaultRanges(low, range, indexHigh);
const int idx = (int)(colToDbl(color->c[0]) + 0.5) * n;
- if (likely(idx + n < (indexHigh + 1) * base->getNComps())) {
+ if (likely((idx + n < (indexHigh + 1) * base->getNComps()) && idx >= 0)) {
p = &lookup[idx];
for (i = 0; i < n; ++i) {
baseColor->c[i] = dblToCol(low[i] + (p[i] / 255.0) * range[i]);