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) {
for (k = 0, t = j; k < m; ++k, t >>= 1) {
idx += idxMul[k] * (e[k][t & 1]);
}
- sBuf[j] = samples[idx];
+ if (likely(idx >= 0 && idx < nSamples)) {
+ sBuf[j] = samples[idx];
+ } else {
+ sBuf[j] = 0;
+ }
}
// do m sets of interpolations