[poppler] Branch 'xpdf303merge' - 2 commits - poppler/Function.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Mon Sep 5 12:20:38 PDT 2011


 poppler/Function.cc |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 9529e776e53e71069ba4215cdb8b84592d37b555
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Mon Sep 5 21:19:58 2011 +0200

    xpdf303: Other fixes in PostScriptFunction

diff --git a/poppler/Function.cc b/poppler/Function.cc
index 16ca0f4..25e8f74 100644
--- a/poppler/Function.cc
+++ b/poppler/Function.cc
@@ -1082,7 +1082,7 @@ void PSStack::roll(int n, int j) {
       j = n - j;
     }
   }
-  if (n <= 0 || j == 0) {
+  if (n <= 0 || j == 0 || n > psStackSize || sp + n > psStackSize) {
     return;
   }
   if (j <= n / 2) {
@@ -1318,6 +1318,7 @@ GBool PostScriptFunction::parseCode(Stream *str, int *codePtr) {
     } else {
       a = -1;
       b = nPSOps;
+      cmp = 0; // make gcc happy
       // invariant: psOpNames[a] < tok < psOpNames[b]
       while (b - a > 1) {
 	mid = (a + b) / 2;
@@ -1459,7 +1460,7 @@ void PostScriptFunction::exec(PSStack *stack, int codePtr) {
 	if (i2 > 0) {
 	  stack->pushInt(i1 << i2);
 	} else if (i2 < 0) {
-	  stack->pushInt((int)((Guint)i1 >> i2));
+	  stack->pushInt((int)((Guint)i1 >> -i2));
 	} else {
 	  stack->pushInt(i1);
 	}
commit 071f983f461ba0b872dd93d7f1a24d325312799d
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Mon Sep 5 21:19:13 2011 +0200

    xpdf303: Fixed a bug in the PostScript-type function parser
    
    Real numbers that start with a decimal point weren't being handled
    correctly.

diff --git a/poppler/Function.cc b/poppler/Function.cc
index db390dc..16ca0f4 100644
--- a/poppler/Function.cc
+++ b/poppler/Function.cc
@@ -1238,7 +1238,7 @@ GBool PostScriptFunction::parseCode(Stream *str, int *codePtr) {
     p = tok->getCString();
     if (isdigit(*p) || *p == '.' || *p == '-') {
       isReal = gFalse;
-      for (++p; *p; ++p) {
+      for (; *p; ++p) {
 	if (*p == '.') {
 	  isReal = gTrue;
 	  break;


More information about the poppler mailing list