summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2017-05-04 21:24:23 +0200
committerAlbert Astals Cid <aacid@kde.org>2017-05-04 21:24:23 +0200
commitb2545e9368a58a6987614f75d39da4568a076881 (patch)
tree4eacc8d592abadb1b65257ca8bba7f3fa3051e26
parent09000ce81397eba1eed383f730e48b92b932e0b4 (diff)
Fix regression in GfxIndexedColorSpace::mapColorToBase
The bounds check was off by one, making file from bug 100931 render incorrectly. Bug #100931
-rw-r--r--poppler/GfxState.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index 331d78cf..2c81dfbe 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-2016 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2017 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2009, 2012 Koji Otani <sho@bbr.jp>
// Copyright (C) 2009, 2011-2016 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright (C) 2009 Christian Persch <chpe@gnome.org>
@@ -2663,7 +2663,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()) && idx >= 0)) {
+ if (likely((idx + n - 1 < (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]);