Commit 2394acf7a688b2d080d4233d66a6e22bf46f0fca
1 parent
a0b1a181
Remove explicit direct object check from getObject
An indirect object reference to 0, 0 is invalid. If it appears in the file or is parsed from a string, the parser catches it. This check would only be useful for someone explicitly calling getObject with 0, 0, and that would trigger an error during resolve().
Showing
3 changed files
with
3 additions
and
5 deletions
libqpdf/QPDF.cc
| ... | ... | @@ -1781,9 +1781,8 @@ QPDF::readObjectAtOffset( |
| 1781 | 1781 | // not triggered by an xref lookup. |
| 1782 | 1782 | check_og = false; |
| 1783 | 1783 | try_recovery = false; |
| 1784 | - } else { | |
| 1785 | - setLastObjectDescription(description, exp_og); | |
| 1786 | 1784 | } |
| 1785 | + setLastObjectDescription(description, exp_og); | |
| 1787 | 1786 | |
| 1788 | 1787 | if (!this->m->attempt_recovery) { |
| 1789 | 1788 | try_recovery = false; |
| ... | ... | @@ -2190,9 +2189,6 @@ QPDF::reserveStream(QPDFObjGen const& og) |
| 2190 | 2189 | QPDFObjectHandle |
| 2191 | 2190 | QPDF::getObject(QPDFObjGen const& og) |
| 2192 | 2191 | { |
| 2193 | - if (!og.isIndirect()) { | |
| 2194 | - return QPDFObjectHandle::newNull(); | |
| 2195 | - } | |
| 2196 | 2192 | if (!isCached(og)) { |
| 2197 | 2193 | m->obj_cache[og] = ObjCache(QPDF_Unresolved::create(this, og), -1, -1); |
| 2198 | 2194 | } | ... | ... |
qpdf/qtest/qpdf/issue-143.out
| ... | ... | @@ -14,5 +14,6 @@ WARNING: issue-143.pdf (object 1 0, offset 21): stream dictionary lacks /Length |
| 14 | 14 | WARNING: issue-143.pdf (object 1 0, offset 84): attempting to recover stream length |
| 15 | 15 | WARNING: issue-143.pdf (object 1 0, offset 84): recovered stream length: 606 |
| 16 | 16 | WARNING: issue-143.pdf object stream 1 (object 2 0, offset 33): expected dictionary key but found non-name object; inserting key /QPDFFake1 |
| 17 | +WARNING: issue-143.pdf: object 0/0 has unexpected xref entry type | |
| 17 | 18 | WARNING: issue-143.pdf (object 2 0, offset 84): supposed object stream 12336 is not a stream |
| 18 | 19 | qpdf: operation succeeded with warnings; resulting file may have some problems | ... | ... |