From cb585df253940148a051a7d21c389ba894381d90 Mon Sep 17 00:00:00 2001 From: Michael Weiser Date: Fri, 6 Mar 2020 15:18:31 +0100 Subject: [PATCH] Fix object stream parsing Commit 8cc27b6a 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" } } } --- peepdf/PDFCore.py | 1 - 1 file changed, 1 deletion(-) diff --git a/peepdf/PDFCore.py b/peepdf/PDFCore.py index a61d776..44e56f8 100644 --- a/peepdf/PDFCore.py +++ b/peepdf/PDFCore.py @@ -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'