diff --git a/libqpdf/QPDF_linearization.cc b/libqpdf/QPDF_linearization.cc index 222879e..e4ea689 100644 --- a/libqpdf/QPDF_linearization.cc +++ b/libqpdf/QPDF_linearization.cc @@ -130,18 +130,17 @@ QPDF::isLinearized() return false; } - QPDFObjectHandle L = candidate.getKey("/L"); - if (L.isInteger()) { - qpdf_offset_t Li = L.getIntValue(); - m->file->seek(0, SEEK_END); - if (Li != m->file->tell()) { - QTC::TC("qpdf", "QPDF /L mismatch"); - return false; - } else { - m->linp.file_size = Li; - } + auto L = candidate.getKey("/L"); + if (!L.isInteger()) { + return false; } - + qpdf_offset_t Li = L.getIntValue(); + m->file->seek(0, SEEK_END); + if (Li != m->file->tell()) { + QTC::TC("qpdf", "QPDF /L mismatch"); + return false; + } + m->linp.file_size = Li; m->lindict = candidate; return true; } diff --git a/manual/release-notes.rst b/manual/release-notes.rst index 763b1a0..7eae202 100644 --- a/manual/release-notes.rst +++ b/manual/release-notes.rst @@ -13,12 +13,20 @@ more detail. .. x.y.z: not yet released +12.0.1: not yet released + - Bug fixes + + - In ``QPDF::isLinearized`` return false if the first object in the file is + not a linearization parameter dictionary or its ``/L`` entry is not an + integer object. Previously the method returned false if the first + dictionary object was not a linearization parameter dictionary. + .. _r12-0-0: .. cSpell:ignore substract 12.0.0: March 9, 2025 - - API: breaking changes + - API breaking changes - The header file ``qpdf/QPDFObject.hh`` now generates an error if included. This is to prevent code that includes it from