[poppler] poppler/Stream.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Mon Oct 23 21:31:55 UTC 2017


 poppler/Stream.cc |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

New commits:
commit d72f0383b959d8495a452d2d32377e588b15ad65
Author: Kay Dohmann <k.dohmann at gmx.net>
Date:   Mon Oct 23 23:31:13 2017 +0200

    Tweak LZWStream::processNextCode
    
    Fixes file attached at bug 103174 and doesn't seem to cause any
    regression in the files we have around
    
    Bug #103174

diff --git a/poppler/Stream.cc b/poppler/Stream.cc
index b541356d..da1d9267 100644
--- a/poppler/Stream.cc
+++ b/poppler/Stream.cc
@@ -33,6 +33,7 @@
 // Copyright (C) 2015 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
 // Copyright (C) 2015 Jason Crain <jason at aquaticape.us>
 // Copyright (C) 2017 Jose Aliste <jaliste at src.gnome.org>
+// Copyright (C) 2017 Kay Dohmann <k.dohmann at gmx.net>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -1461,11 +1462,6 @@ GBool LZWStream::processNextCode() {
     clearTable();
     goto start;
   }
-  if (nextCode >= 4097) {
-    error(errSyntaxError, getPos(),
-	  "Bad LZW stream - expected clear-table code");
-    clearTable();
-  }
 
   // process the next code
   nextLength = seqLength + 1;
@@ -1491,10 +1487,12 @@ GBool LZWStream::processNextCode() {
   if (first) {
     first = gFalse;
   } else {
-    table[nextCode].length = nextLength;
-    table[nextCode].head = prevCode;
-    table[nextCode].tail = newChar;
-    ++nextCode;
+    if (nextCode < 4097) {
+      table[nextCode].length = nextLength;
+      table[nextCode].head = prevCode;
+      table[nextCode].tail = newChar;
+      ++nextCode;
+    }
     if (nextCode + early == 512)
       nextBits = 10;
     else if (nextCode + early == 1024)


More information about the poppler mailing list