summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2010-09-21 19:08:54 +0100
committerAlbert Astals Cid <aacid@kde.org>2010-09-21 19:08:54 +0100
commit26a5817ffec9f05ac63db6c5cd5b1f0871d271c7 (patch)
treefb94127aa768dfa2bddd61d4bd6088bb7290fcbc
parentdfdf3602bde47d1be7788a44722c258bfa0c6d6e (diff)
Fix crash when idx is out of range
Fixes crash in broken pdf provided by Joel Voss of Leviathan Security Group
-rw-r--r--poppler/Function.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/poppler/Function.cc b/poppler/Function.cc
index b28ee3df..ea35b7b8 100644
--- a/poppler/Function.cc
+++ b/poppler/Function.cc
@@ -422,7 +422,11 @@ void SampledFunction::transform(double *in, double *out) {
422 for (k = 0, t = j; k < m; ++k, t >>= 1) { 422 for (k = 0, t = j; k < m; ++k, t >>= 1) {
423 idx += idxMul[k] * (e[k][t & 1]); 423 idx += idxMul[k] * (e[k][t & 1]);
424 } 424 }
425 sBuf[j] = samples[idx]; 425 if (likely(idx >= 0 && idx < nSamples)) {
426 sBuf[j] = samples[idx];
427 } else {
428 sBuf[j] = 0;
429 }
426 } 430 }
427 431
428 // do m sets of interpolations 432 // do m sets of interpolations