Commit 71566a2761fa7ec0fca418540325deca368cfb79
1 parent
9fc02e2f
Write offsets as unsigned in linearization hint tables (fixes #1023)
Showing
3 changed files
with
13 additions
and
4 deletions
ChangeLog
| 1 | 1 | 2023-10-14 Jay Berkenbilt <ejb@ql.org> |
| 2 | 2 | |
| 3 | + * Tweak linearization code to better handle files between 2 GB and | |
| 4 | + 4 GB in size. Fixes #1023. | |
| 5 | + | |
| 3 | 6 | * Fix serious bug: qpdf could discard a the character after an |
| 4 | 7 | escaped octal string. For content, this would only happen with QDF |
| 5 | 8 | or when normalizing content, but it could have happened in a | ... | ... |
include/qpdf/QPDF.hh
libqpdf/QPDF_linearization.cc
| ... | ... | @@ -1670,11 +1670,11 @@ QPDF::writeHPageOffset(BitWriter& w) |
| 1670 | 1670 | HPageOffset& t = m->page_offset_hints; |
| 1671 | 1671 | |
| 1672 | 1672 | w.writeBitsInt(t.min_nobjects, 32); // 1 |
| 1673 | - w.writeBitsInt(toI(t.first_page_offset), 32); // 2 | |
| 1673 | + w.writeBits(toULL(t.first_page_offset), 32); // 2 | |
| 1674 | 1674 | w.writeBitsInt(t.nbits_delta_nobjects, 16); // 3 |
| 1675 | 1675 | w.writeBitsInt(t.min_page_length, 32); // 4 |
| 1676 | 1676 | w.writeBitsInt(t.nbits_delta_page_length, 16); // 5 |
| 1677 | - w.writeBitsInt(t.min_content_offset, 32); // 6 | |
| 1677 | + w.writeBits(toULL(t.min_content_offset), 32); // 6 | |
| 1678 | 1678 | w.writeBitsInt(t.nbits_delta_content_offset, 16); // 7 |
| 1679 | 1679 | w.writeBitsInt(t.min_content_length, 32); // 8 |
| 1680 | 1680 | w.writeBitsInt(t.nbits_delta_content_length, 16); // 9 |
| ... | ... | @@ -1717,7 +1717,7 @@ QPDF::writeHSharedObject(BitWriter& w) |
| 1717 | 1717 | HSharedObject& t = m->shared_object_hints; |
| 1718 | 1718 | |
| 1719 | 1719 | w.writeBitsInt(t.first_shared_obj, 32); // 1 |
| 1720 | - w.writeBitsInt(toI(t.first_shared_offset), 32); // 2 | |
| 1720 | + w.writeBits(toULL(t.first_shared_offset), 32); // 2 | |
| 1721 | 1721 | w.writeBitsInt(t.nshared_first_page, 32); // 3 |
| 1722 | 1722 | w.writeBitsInt(t.nshared_total, 32); // 4 |
| 1723 | 1723 | w.writeBitsInt(t.nbits_nobjects, 16); // 5 |
| ... | ... | @@ -1749,7 +1749,7 @@ void |
| 1749 | 1749 | QPDF::writeHGeneric(BitWriter& w, HGeneric& t) |
| 1750 | 1750 | { |
| 1751 | 1751 | w.writeBitsInt(t.first_object, 32); // 1 |
| 1752 | - w.writeBitsInt(toI(t.first_object_offset), 32); // 2 | |
| 1752 | + w.writeBits(toULL(t.first_object_offset), 32); // 2 | |
| 1753 | 1753 | w.writeBitsInt(t.nobjects, 32); // 3 |
| 1754 | 1754 | w.writeBitsInt(t.group_length, 32); // 4 |
| 1755 | 1755 | } | ... | ... |