$NetBSD: patch-bf,v 1.1 2010/10/01 21:32:34 spz Exp $

security fixes for http://secunia.com/advisories/41596/
taken from http://cgit.freedesktop.org/poppler

- Properly initialize stack
- Fix crash when idx is out of range

--- poppler/Function.cc.orig	2010-07-24 12:01:53.000000000 +0000
+++ poppler/Function.cc
@@ -422,7 +422,11 @@ void SampledFunction::transform(double *
       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
@@ -1108,6 +1112,7 @@ PostScriptFunction::PostScriptFunction(O
   code = NULL;
   codeString = NULL;
   codeSize = 0;
+  stack = NULL;
   ok = gFalse;
   cache = new PopplerCache(5);
 
