2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-05-29 08:20:53 +00:00

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().
This commit is contained in:
Jay Berkenbilt 2022-09-13 11:21:29 -04:00
parent a0b1a18172
commit 2394acf7a6
3 changed files with 3 additions and 5 deletions

View File

@ -1781,9 +1781,8 @@ QPDF::readObjectAtOffset(
// not triggered by an xref lookup.
check_og = false;
try_recovery = false;
} else {
setLastObjectDescription(description, exp_og);
}
setLastObjectDescription(description, exp_og);
if (!this->m->attempt_recovery) {
try_recovery = false;
@ -2190,9 +2189,6 @@ QPDF::reserveStream(QPDFObjGen const& og)
QPDFObjectHandle
QPDF::getObject(QPDFObjGen const& og)
{
if (!og.isIndirect()) {
return QPDFObjectHandle::newNull();
}
if (!isCached(og)) {
m->obj_cache[og] = ObjCache(QPDF_Unresolved::create(this, og), -1, -1);
}

View File

@ -14,5 +14,6 @@ WARNING: issue-143.pdf (object 1 0, offset 21): stream dictionary lacks /Length
WARNING: issue-143.pdf (object 1 0, offset 84): attempting to recover stream length
WARNING: issue-143.pdf (object 1 0, offset 84): recovered stream length: 606
WARNING: issue-143.pdf object stream 1 (object 2 0, offset 33): expected dictionary key but found non-name object; inserting key /QPDFFake1
WARNING: issue-143.pdf: object 0/0 has unexpected xref entry type
WARNING: issue-143.pdf (object 2 0, offset 84): supposed object stream 12336 is not a stream
qpdf: operation succeeded with warnings; resulting file may have some problems

View File

@ -5,4 +5,5 @@ checking obj0.pdf
PDF Version: 1.3
File is not encrypted
File is not linearized
WARNING: obj0.pdf (offset 15): object with ID 0
qpdf: operation succeeded with warnings