Include omitted object description in error message

This commit is contained in:
Jay Berkenbilt 2018-02-16 18:34:43 -05:00
parent cb3b705cf9
commit 52e024f701
8 changed files with 49 additions and 45 deletions

View File

@ -1,5 +1,8 @@
2018-02-17 Jay Berkenbilt <ejb@ql.org>
* Error message fix: correct some cases in which the object that
contained a lexical error was omitted from the error message.
* Error message fix: improve file name in the error message when
there is a parser error inside an object stream.

View File

@ -1269,7 +1269,8 @@ QPDF::readObject(PointerHolder<InputSource> input,
decrypter = decrypter_ph.getPointer();
}
QPDFObjectHandle object = QPDFObjectHandle::parse(
input, description, this->m->tokenizer, empty, decrypter, this);
input, this->m->last_object_description,
this->m->tokenizer, empty, decrypter, this);
if (empty)
{
// Nothing in the PDF spec appears to allow empty objects, but

View File

@ -2,4 +2,4 @@ checking eof-reading-token.pdf
PDF Version: 1.3
File is not encrypted
File is not linearized
WARNING: eof-reading-token.pdf object stream 12 (file position 5): EOF while reading token
WARNING: eof-reading-token.pdf object stream 12 (object 13 0, file position 5): EOF while reading token

View File

@ -1,6 +1,6 @@
WARNING: indirect-r-arg.pdf (file position 76): unknown token while reading object; treating as string
WARNING: indirect-r-arg.pdf (file position 62): expected dictionary key but found non-name object; inserting key /QPDFFake1
WARNING: indirect-r-arg.pdf (file position 62): expected dictionary key but found non-name object; inserting key /QPDFFake2
WARNING: indirect-r-arg.pdf (object 1 0, file position 76): unknown token while reading object; treating as string
WARNING: indirect-r-arg.pdf (object 1 0, file position 62): expected dictionary key but found non-name object; inserting key /QPDFFake1
WARNING: indirect-r-arg.pdf (object 1 0, file position 62): expected dictionary key but found non-name object; inserting key /QPDFFake2
checking indirect-r-arg.pdf
PDF Version: 1.3
File is not encrypted

View File

@ -1,13 +1,13 @@
WARNING: issue-100.pdf: file is damaged
WARNING: issue-100.pdf (file position 736): xref not found
WARNING: issue-100.pdf: Attempting to reconstruct cross-reference table
WARNING: issue-100.pdf (file position 268): unknown token while reading object; treating as string
WARNING: issue-100.pdf (file position 286): unknown token while reading object; treating as string
WARNING: issue-100.pdf (file position 289): unknown token while reading object; treating as string
WARNING: issue-100.pdf (file position 294): unknown token while reading object; treating as string
WARNING: issue-100.pdf (file position 297): unknown token while reading object; treating as string
WARNING: issue-100.pdf (file position 304): unknown token while reading object; treating as string
WARNING: issue-100.pdf (file position 308): unexpected )
WARNING: issue-100.pdf (object 5 0, file position 268): unknown token while reading object; treating as string
WARNING: issue-100.pdf (object 5 0, file position 286): unknown token while reading object; treating as string
WARNING: issue-100.pdf (object 5 0, file position 289): unknown token while reading object; treating as string
WARNING: issue-100.pdf (object 5 0, file position 294): unknown token while reading object; treating as string
WARNING: issue-100.pdf (object 5 0, file position 297): unknown token while reading object; treating as string
WARNING: issue-100.pdf (object 5 0, file position 304): unknown token while reading object; treating as string
WARNING: issue-100.pdf (object 5 0, file position 308): unexpected )
WARNING: issue-100.pdf (object 5 0, file position 418): /Length key in stream dictionary is not an integer
WARNING: issue-100.pdf (object 5 0, file position 489): attempting to recover stream length
WARNING: issue-100.pdf (object 5 0, file position 489): recovered stream length: 12

View File

@ -1,8 +1,8 @@
WARNING: issue-101.pdf: file is damaged
WARNING: issue-101.pdf (file position 3526): xref not found
WARNING: issue-101.pdf: Attempting to reconstruct cross-reference table
WARNING: issue-101.pdf (file position 1242): expected dictionary key but found non-name object; inserting key /QPDFFake1
WARNING: issue-101.pdf (file position 1242): dictionary ended prematurely; using null as value for last key
WARNING: issue-101.pdf (object 5 0, file position 1242): expected dictionary key but found non-name object; inserting key /QPDFFake1
WARNING: issue-101.pdf (object 5 0, file position 1242): dictionary ended prematurely; using null as value for last key
WARNING: issue-101.pdf (object 5 0, file position 1438): /Length key in stream dictionary is not an integer
WARNING: issue-101.pdf (object 5 0, file position 1509): attempting to recover stream length
WARNING: issue-101.pdf (object 5 0, file position 1509): recovered stream length: 8
@ -32,28 +32,28 @@ WARNING: issue-101.pdf (trailer, file position 3631): recovered stream length: 8
WARNING: issue-101.pdf (trailer, file position 4113): /Length key in stream dictionary is not an integer
WARNING: issue-101.pdf (trailer, file position 4184): attempting to recover stream length
WARNING: issue-101.pdf (trailer, file position 4184): recovered stream length: 8
WARNING: issue-101.pdf (file position 591): unknown token while reading object; treating as string
WARNING: issue-101.pdf (file position 625): treating unexpected brace token as null
WARNING: issue-101.pdf (file position 626): unknown token while reading object; treating as string
WARNING: issue-101.pdf (file position 637): unknown token while reading object; treating as string
WARNING: issue-101.pdf (file position 639): unknown token while reading object; treating as string
WARNING: issue-101.pdf (file position 644): unknown token while reading object; treating as string
WARNING: issue-101.pdf (file position 647): unknown token while reading object; treating as string
WARNING: issue-101.pdf (file position 687): unknown token while reading object; treating as string
WARNING: issue-101.pdf (file position 691): unknown token while reading object; treating as string
WARNING: issue-101.pdf (file position 696): unknown token while reading object; treating as string
WARNING: issue-101.pdf (file position 698): unknown token while reading object; treating as string
WARNING: issue-101.pdf (file position 701): unknown token while reading object; treating as string
WARNING: issue-101.pdf (file position 711): unknown token while reading object; treating as string
WARNING: issue-101.pdf (file position 743): unknown token while reading object; treating as string
WARNING: issue-101.pdf (file position 745): unknown token while reading object; treating as string
WARNING: issue-101.pdf (file position 747): unknown token while reading object; treating as string
WARNING: issue-101.pdf (file position 777): unknown token while reading object; treating as string
WARNING: issue-101.pdf (file position 790): unknown token while reading object; treating as string
WARNING: issue-101.pdf (file position 800): treating unexpected brace token as null
WARNING: issue-101.pdf (file position 801): unknown token while reading object; treating as string
WARNING: issue-101.pdf (file position 811): unknown token while reading object; treating as string
WARNING: issue-101.pdf (file position 819): unknown token while reading object; treating as string
WARNING: issue-101.pdf (file position 832): unknown token while reading object; treating as string
WARNING: issue-101.pdf (file position 856): unexpected >
WARNING: issue-101.pdf (object 11 0, file position 591): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, file position 625): treating unexpected brace token as null
WARNING: issue-101.pdf (object 11 0, file position 626): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, file position 637): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, file position 639): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, file position 644): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, file position 647): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, file position 687): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, file position 691): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, file position 696): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, file position 698): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, file position 701): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, file position 711): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, file position 743): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, file position 745): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, file position 747): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, file position 777): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, file position 790): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, file position 800): treating unexpected brace token as null
WARNING: issue-101.pdf (object 11 0, file position 801): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, file position 811): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, file position 819): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, file position 832): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, file position 856): unexpected >
issue-101.pdf (file position 856): unable to find /Root dictionary

View File

@ -1,3 +1,3 @@
WARNING: issue-119.pdf (file position 298): expected dictionary key but found non-name object; inserting key /QPDFFake1
WARNING: issue-119.pdf (file position 298): expected dictionary key but found non-name object; inserting key /QPDFFake2
WARNING: issue-119.pdf (object 4 0, file position 298): expected dictionary key but found non-name object; inserting key /QPDFFake1
WARNING: issue-119.pdf (object 4 0, file position 298): expected dictionary key but found non-name object; inserting key /QPDFFake2
qpdf: operation succeeded with warnings; resulting file may have some problems

View File

@ -6,12 +6,12 @@ WARNING: issue-143.pdf (xref stream: object 3 0, file position 654): recovered s
WARNING: issue-143.pdf: file is damaged
WARNING: issue-143.pdf (object 1 0, file position 48): expected n n obj
WARNING: issue-143.pdf: Attempting to reconstruct cross-reference table
WARNING: issue-143.pdf (file position 24): expected dictionary key but found non-name object; inserting key /QPDFFake1
WARNING: issue-143.pdf (file position 24): expected dictionary key but found non-name object; inserting key /QPDFFake2
WARNING: issue-143.pdf (file position 24): expected dictionary key but found non-name object; inserting key /QPDFFake3
WARNING: issue-143.pdf (file position 24): expected dictionary key but found non-name object; inserting key /QPDFFake4
WARNING: issue-143.pdf (object 1 0, file position 24): expected dictionary key but found non-name object; inserting key /QPDFFake1
WARNING: issue-143.pdf (object 1 0, file position 24): expected dictionary key but found non-name object; inserting key /QPDFFake2
WARNING: issue-143.pdf (object 1 0, file position 24): expected dictionary key but found non-name object; inserting key /QPDFFake3
WARNING: issue-143.pdf (object 1 0, file position 24): expected dictionary key but found non-name object; inserting key /QPDFFake4
WARNING: issue-143.pdf (object 1 0, file position 21): stream dictionary lacks /Length key
WARNING: issue-143.pdf (object 1 0, file position 84): attempting to recover stream length
WARNING: issue-143.pdf (object 1 0, file position 84): recovered stream length: 606
WARNING: issue-143.pdf object stream 1 (file position 33): expected dictionary key but found non-name object; inserting key /QPDFFake1
WARNING: issue-143.pdf object stream 1 (object 2 0, file position 33): expected dictionary key but found non-name object; inserting key /QPDFFake1
qpdf: operation succeeded with warnings; resulting file may have some problems