Commit 52e024f70198e18c96f613a789baa79622e8f1ea

Authored by Jay Berkenbilt
1 parent cb3b705c

Include omitted object description in error message

ChangeLog
1 1 2018-02-17 Jay Berkenbilt <ejb@ql.org>
2 2  
  3 + * Error message fix: correct some cases in which the object that
  4 + contained a lexical error was omitted from the error message.
  5 +
3 6 * Error message fix: improve file name in the error message when
4 7 there is a parser error inside an object stream.
5 8  
... ...
libqpdf/QPDF.cc
... ... @@ -1269,7 +1269,8 @@ QPDF::readObject(PointerHolder&lt;InputSource&gt; input,
1269 1269 decrypter = decrypter_ph.getPointer();
1270 1270 }
1271 1271 QPDFObjectHandle object = QPDFObjectHandle::parse(
1272   - input, description, this->m->tokenizer, empty, decrypter, this);
  1272 + input, this->m->last_object_description,
  1273 + this->m->tokenizer, empty, decrypter, this);
1273 1274 if (empty)
1274 1275 {
1275 1276 // Nothing in the PDF spec appears to allow empty objects, but
... ...
qpdf/qtest/qpdf/eof-reading-token.out
... ... @@ -2,4 +2,4 @@ checking eof-reading-token.pdf
2 2 PDF Version: 1.3
3 3 File is not encrypted
4 4 File is not linearized
5   -WARNING: eof-reading-token.pdf object stream 12 (file position 5): EOF while reading token
  5 +WARNING: eof-reading-token.pdf object stream 12 (object 13 0, file position 5): EOF while reading token
... ...
qpdf/qtest/qpdf/indirect-r-arg.out
1   -WARNING: indirect-r-arg.pdf (file position 76): unknown token while reading object; treating as string
2   -WARNING: indirect-r-arg.pdf (file position 62): expected dictionary key but found non-name object; inserting key /QPDFFake1
3   -WARNING: indirect-r-arg.pdf (file position 62): expected dictionary key but found non-name object; inserting key /QPDFFake2
  1 +WARNING: indirect-r-arg.pdf (object 1 0, file position 76): unknown token while reading object; treating as string
  2 +WARNING: indirect-r-arg.pdf (object 1 0, file position 62): expected dictionary key but found non-name object; inserting key /QPDFFake1
  3 +WARNING: indirect-r-arg.pdf (object 1 0, file position 62): expected dictionary key but found non-name object; inserting key /QPDFFake2
4 4 checking indirect-r-arg.pdf
5 5 PDF Version: 1.3
6 6 File is not encrypted
... ...
qpdf/qtest/qpdf/issue-100.out
1 1 WARNING: issue-100.pdf: file is damaged
2 2 WARNING: issue-100.pdf (file position 736): xref not found
3 3 WARNING: issue-100.pdf: Attempting to reconstruct cross-reference table
4   -WARNING: issue-100.pdf (file position 268): unknown token while reading object; treating as string
5   -WARNING: issue-100.pdf (file position 286): unknown token while reading object; treating as string
6   -WARNING: issue-100.pdf (file position 289): unknown token while reading object; treating as string
7   -WARNING: issue-100.pdf (file position 294): unknown token while reading object; treating as string
8   -WARNING: issue-100.pdf (file position 297): unknown token while reading object; treating as string
9   -WARNING: issue-100.pdf (file position 304): unknown token while reading object; treating as string
10   -WARNING: issue-100.pdf (file position 308): unexpected )
  4 +WARNING: issue-100.pdf (object 5 0, file position 268): unknown token while reading object; treating as string
  5 +WARNING: issue-100.pdf (object 5 0, file position 286): unknown token while reading object; treating as string
  6 +WARNING: issue-100.pdf (object 5 0, file position 289): unknown token while reading object; treating as string
  7 +WARNING: issue-100.pdf (object 5 0, file position 294): unknown token while reading object; treating as string
  8 +WARNING: issue-100.pdf (object 5 0, file position 297): unknown token while reading object; treating as string
  9 +WARNING: issue-100.pdf (object 5 0, file position 304): unknown token while reading object; treating as string
  10 +WARNING: issue-100.pdf (object 5 0, file position 308): unexpected )
11 11 WARNING: issue-100.pdf (object 5 0, file position 418): /Length key in stream dictionary is not an integer
12 12 WARNING: issue-100.pdf (object 5 0, file position 489): attempting to recover stream length
13 13 WARNING: issue-100.pdf (object 5 0, file position 489): recovered stream length: 12
... ...
qpdf/qtest/qpdf/issue-101.out
1 1 WARNING: issue-101.pdf: file is damaged
2 2 WARNING: issue-101.pdf (file position 3526): xref not found
3 3 WARNING: issue-101.pdf: Attempting to reconstruct cross-reference table
4   -WARNING: issue-101.pdf (file position 1242): expected dictionary key but found non-name object; inserting key /QPDFFake1
5   -WARNING: issue-101.pdf (file position 1242): dictionary ended prematurely; using null as value for last key
  4 +WARNING: issue-101.pdf (object 5 0, file position 1242): expected dictionary key but found non-name object; inserting key /QPDFFake1
  5 +WARNING: issue-101.pdf (object 5 0, file position 1242): dictionary ended prematurely; using null as value for last key
6 6 WARNING: issue-101.pdf (object 5 0, file position 1438): /Length key in stream dictionary is not an integer
7 7 WARNING: issue-101.pdf (object 5 0, file position 1509): attempting to recover stream length
8 8 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
32 32 WARNING: issue-101.pdf (trailer, file position 4113): /Length key in stream dictionary is not an integer
33 33 WARNING: issue-101.pdf (trailer, file position 4184): attempting to recover stream length
34 34 WARNING: issue-101.pdf (trailer, file position 4184): recovered stream length: 8
35   -WARNING: issue-101.pdf (file position 591): unknown token while reading object; treating as string
36   -WARNING: issue-101.pdf (file position 625): treating unexpected brace token as null
37   -WARNING: issue-101.pdf (file position 626): unknown token while reading object; treating as string
38   -WARNING: issue-101.pdf (file position 637): unknown token while reading object; treating as string
39   -WARNING: issue-101.pdf (file position 639): unknown token while reading object; treating as string
40   -WARNING: issue-101.pdf (file position 644): unknown token while reading object; treating as string
41   -WARNING: issue-101.pdf (file position 647): unknown token while reading object; treating as string
42   -WARNING: issue-101.pdf (file position 687): unknown token while reading object; treating as string
43   -WARNING: issue-101.pdf (file position 691): unknown token while reading object; treating as string
44   -WARNING: issue-101.pdf (file position 696): unknown token while reading object; treating as string
45   -WARNING: issue-101.pdf (file position 698): unknown token while reading object; treating as string
46   -WARNING: issue-101.pdf (file position 701): unknown token while reading object; treating as string
47   -WARNING: issue-101.pdf (file position 711): unknown token while reading object; treating as string
48   -WARNING: issue-101.pdf (file position 743): unknown token while reading object; treating as string
49   -WARNING: issue-101.pdf (file position 745): unknown token while reading object; treating as string
50   -WARNING: issue-101.pdf (file position 747): unknown token while reading object; treating as string
51   -WARNING: issue-101.pdf (file position 777): unknown token while reading object; treating as string
52   -WARNING: issue-101.pdf (file position 790): unknown token while reading object; treating as string
53   -WARNING: issue-101.pdf (file position 800): treating unexpected brace token as null
54   -WARNING: issue-101.pdf (file position 801): unknown token while reading object; treating as string
55   -WARNING: issue-101.pdf (file position 811): unknown token while reading object; treating as string
56   -WARNING: issue-101.pdf (file position 819): unknown token while reading object; treating as string
57   -WARNING: issue-101.pdf (file position 832): unknown token while reading object; treating as string
58   -WARNING: issue-101.pdf (file position 856): unexpected >
  35 +WARNING: issue-101.pdf (object 11 0, file position 591): unknown token while reading object; treating as string
  36 +WARNING: issue-101.pdf (object 11 0, file position 625): treating unexpected brace token as null
  37 +WARNING: issue-101.pdf (object 11 0, file position 626): unknown token while reading object; treating as string
  38 +WARNING: issue-101.pdf (object 11 0, file position 637): unknown token while reading object; treating as string
  39 +WARNING: issue-101.pdf (object 11 0, file position 639): unknown token while reading object; treating as string
  40 +WARNING: issue-101.pdf (object 11 0, file position 644): unknown token while reading object; treating as string
  41 +WARNING: issue-101.pdf (object 11 0, file position 647): unknown token while reading object; treating as string
  42 +WARNING: issue-101.pdf (object 11 0, file position 687): unknown token while reading object; treating as string
  43 +WARNING: issue-101.pdf (object 11 0, file position 691): unknown token while reading object; treating as string
  44 +WARNING: issue-101.pdf (object 11 0, file position 696): unknown token while reading object; treating as string
  45 +WARNING: issue-101.pdf (object 11 0, file position 698): unknown token while reading object; treating as string
  46 +WARNING: issue-101.pdf (object 11 0, file position 701): unknown token while reading object; treating as string
  47 +WARNING: issue-101.pdf (object 11 0, file position 711): unknown token while reading object; treating as string
  48 +WARNING: issue-101.pdf (object 11 0, file position 743): unknown token while reading object; treating as string
  49 +WARNING: issue-101.pdf (object 11 0, file position 745): unknown token while reading object; treating as string
  50 +WARNING: issue-101.pdf (object 11 0, file position 747): unknown token while reading object; treating as string
  51 +WARNING: issue-101.pdf (object 11 0, file position 777): unknown token while reading object; treating as string
  52 +WARNING: issue-101.pdf (object 11 0, file position 790): unknown token while reading object; treating as string
  53 +WARNING: issue-101.pdf (object 11 0, file position 800): treating unexpected brace token as null
  54 +WARNING: issue-101.pdf (object 11 0, file position 801): unknown token while reading object; treating as string
  55 +WARNING: issue-101.pdf (object 11 0, file position 811): unknown token while reading object; treating as string
  56 +WARNING: issue-101.pdf (object 11 0, file position 819): unknown token while reading object; treating as string
  57 +WARNING: issue-101.pdf (object 11 0, file position 832): unknown token while reading object; treating as string
  58 +WARNING: issue-101.pdf (object 11 0, file position 856): unexpected >
59 59 issue-101.pdf (file position 856): unable to find /Root dictionary
... ...
qpdf/qtest/qpdf/issue-119.out
1   -WARNING: issue-119.pdf (file position 298): expected dictionary key but found non-name object; inserting key /QPDFFake1
2   -WARNING: issue-119.pdf (file position 298): expected dictionary key but found non-name object; inserting key /QPDFFake2
  1 +WARNING: issue-119.pdf (object 4 0, file position 298): expected dictionary key but found non-name object; inserting key /QPDFFake1
  2 +WARNING: issue-119.pdf (object 4 0, file position 298): expected dictionary key but found non-name object; inserting key /QPDFFake2
3 3 qpdf: operation succeeded with warnings; resulting file may have some problems
... ...
qpdf/qtest/qpdf/issue-143.out
... ... @@ -6,12 +6,12 @@ WARNING: issue-143.pdf (xref stream: object 3 0, file position 654): recovered s
6 6 WARNING: issue-143.pdf: file is damaged
7 7 WARNING: issue-143.pdf (object 1 0, file position 48): expected n n obj
8 8 WARNING: issue-143.pdf: Attempting to reconstruct cross-reference table
9   -WARNING: issue-143.pdf (file position 24): expected dictionary key but found non-name object; inserting key /QPDFFake1
10   -WARNING: issue-143.pdf (file position 24): expected dictionary key but found non-name object; inserting key /QPDFFake2
11   -WARNING: issue-143.pdf (file position 24): expected dictionary key but found non-name object; inserting key /QPDFFake3
12   -WARNING: issue-143.pdf (file position 24): expected dictionary key but found non-name object; inserting key /QPDFFake4
  9 +WARNING: issue-143.pdf (object 1 0, file position 24): expected dictionary key but found non-name object; inserting key /QPDFFake1
  10 +WARNING: issue-143.pdf (object 1 0, file position 24): expected dictionary key but found non-name object; inserting key /QPDFFake2
  11 +WARNING: issue-143.pdf (object 1 0, file position 24): expected dictionary key but found non-name object; inserting key /QPDFFake3
  12 +WARNING: issue-143.pdf (object 1 0, file position 24): expected dictionary key but found non-name object; inserting key /QPDFFake4
13 13 WARNING: issue-143.pdf (object 1 0, file position 21): stream dictionary lacks /Length key
14 14 WARNING: issue-143.pdf (object 1 0, file position 84): attempting to recover stream length
15 15 WARNING: issue-143.pdf (object 1 0, file position 84): recovered stream length: 606
16   -WARNING: issue-143.pdf object stream 1 (file position 33): expected dictionary key but found non-name object; inserting key /QPDFFake1
  16 +WARNING: issue-143.pdf object stream 1 (object 2 0, file position 33): expected dictionary key but found non-name object; inserting key /QPDFFake1
17 17 qpdf: operation succeeded with warnings; resulting file may have some problems
... ...