Commit f54d98bab85f0530356649e9cb2feabb1cc77ee6

Authored by m-holger
1 parent 32eca969

Bug fix - in QPDF::isLinearized return false if /L is not an integer

libqpdf/QPDF_linearization.cc
@@ -130,18 +130,17 @@ QPDF::isLinearized() @@ -130,18 +130,17 @@ QPDF::isLinearized()
130 return false; 130 return false;
131 } 131 }
132 132
133 - QPDFObjectHandle L = candidate.getKey("/L");  
134 - if (L.isInteger()) {  
135 - qpdf_offset_t Li = L.getIntValue();  
136 - m->file->seek(0, SEEK_END);  
137 - if (Li != m->file->tell()) {  
138 - QTC::TC("qpdf", "QPDF /L mismatch");  
139 - return false;  
140 - } else {  
141 - m->linp.file_size = Li;  
142 - } 133 + auto L = candidate.getKey("/L");
  134 + if (!L.isInteger()) {
  135 + return false;
143 } 136 }
144 - 137 + qpdf_offset_t Li = L.getIntValue();
  138 + m->file->seek(0, SEEK_END);
  139 + if (Li != m->file->tell()) {
  140 + QTC::TC("qpdf", "QPDF /L mismatch");
  141 + return false;
  142 + }
  143 + m->linp.file_size = Li;
145 m->lindict = candidate; 144 m->lindict = candidate;
146 return true; 145 return true;
147 } 146 }
manual/release-notes.rst
@@ -13,12 +13,20 @@ more detail. @@ -13,12 +13,20 @@ more detail.
13 13
14 .. x.y.z: not yet released 14 .. x.y.z: not yet released
15 15
  16 +12.0.1: not yet released
  17 + - Bug fixes
  18 +
  19 + - In ``QPDF::isLinearized`` return false if the first object in the file is
  20 + not a linearization parameter dictionary or its ``/L`` entry is not an
  21 + integer object. Previously the method returned false if the first
  22 + dictionary object was not a linearization parameter dictionary.
  23 +
16 .. _r12-0-0: 24 .. _r12-0-0:
17 25
18 .. cSpell:ignore substract 26 .. cSpell:ignore substract
19 27
20 12.0.0: March 9, 2025 28 12.0.0: March 9, 2025
21 - - API: breaking changes 29 + - API breaking changes
22 30
23 - The header file ``qpdf/QPDFObject.hh`` now generates an error if 31 - The header file ``qpdf/QPDFObject.hh`` now generates an error if
24 included. This is to prevent code that includes it from 32 included. This is to prevent code that includes it from