Skip to content

Commit

Permalink
Fix object stream parsing
Browse files Browse the repository at this point in the history
Commit 8cc27b6 broke object stream parsing by resetting the content
cursor PDFParser.charCounter to zero on every invocation. This broke object
stream parsing. Reproducer:

$ echo -e "create pdf\ncreate object_stream\nall\nsave /tmp/foo.pdf" | \
	peepdf -i

Without fix:

$ peepdf -j /tmp/foo.pdf
Error: An error has occurred while parsing an indirect object!!

With this change: JSON output as expected (same for other outputs).

$ peepdf -j /tmp/foo.pdf
{
    "peepdf_analysis": {
[...]
           "version": "0.3"
        }
    }
}
  • Loading branch information
michaelweiser committed Mar 6, 2020
1 parent 11dab2e commit cb585df
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion peepdf/PDFCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -8153,7 +8153,6 @@ def readUntilSymbol(self, string, symbol):

newString = string[self.charCounter:]

self.charCounter = 0
index = newString.find(symbol)
if index == -1:
errorMessage = 'Symbol "'+symbol+'" not found'
Expand Down

0 comments on commit cb585df

Please sign in to comment.