poppler/JPXStream.cc |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 703c77eb59aa22ab6372d56a20ee81dc7dfa6e4a
Author: Even Rouault <[email protected]>
Date:   Fri Dec 28 00:57:17 2012 +0100

    Fix very long loop in JPXStream::getImageParams()

diff --git a/poppler/JPXStream.cc b/poppler/JPXStream.cc
index 606c08e..1476e6a 100644
--- a/poppler/JPXStream.cc
+++ b/poppler/JPXStream.cc
@@ -530,13 +530,19 @@ void JPXStream::getImageParams(int *bitsPerComponent,
                csPrec = csPrec1;
                haveCSMode = gTrue;
              }
-             for (i = 0; i < dataLen - 7; ++i) {
-               bufStr->getChar();
+             if( dataLen >= 7 ) {
+               for (i = 0; i < dataLen - 7; ++i) {
+                 if (bufStr->getChar() == EOF)
+                   break;
+               }
              }
            }
          } else {
-           for (i = 0; i < dataLen - 3; ++i) {
-             bufStr->getChar();
+           if( dataLen >= 3 ) {
+             for (i = 0; i < dataLen - 3; ++i) {
+               if (bufStr->getChar() == EOF)
+                 break;
+             }
            }
          }
        }
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to