Skip to content
  • Thomas Freitag's avatar
    Fix endstream detection · e1ffa910
    Thomas Freitag authored and Albert Astals Cid's avatar Albert Astals Cid committed
    Part 1 of bug #62985
    
    the endstream search, and at least with bug-poppler16579.pdf this doesn't work correctly: the shift(-1) with the used token mechanism in Lexer isn't correct for a binary data stream. If there is i.e. a "(" without corresponding ")" in the binary data, which of course can happen and happens in that pdf, shift(-1) skips the searched endstream and can therefore in worst case reach the end-of-file. Therefore I implemented a shift("endstream") in Java, which I now port back to C++, or in other words "There and Back Again" :-)
    
    You can test it with bug-poppler16579.pdf if You just change temporary
    
              if (longNumber <= INT_MAX && longNumber >= INT_MIN && *end_ptr == '\0') {
    
    in XRef.cc to
    
              if (gFalse && longNumber <= INT_MAX && longNumber >= INT_MIN && *end_ptr == '\0') {
    e1ffa910