Commit Graph

2 Commits

Author SHA1 Message Date
Nico Weber
6111a9f9d0 LibPDF: Make Reference store two u32s instead of one
Reference used to be clever and stored the index of a ref in 18 bits
and the generation in 14 bits, so that both fit into a single u32.

However:
- It set MAX_REF_INDEX incorrectly (the max value of an 18-bit number
  is `(1 << 18) - 1`, not `(1 << 19) - 1`
- pdf_reference_1-7.pdf has 349223 objects, and that's larger
  than `(1 << 18) - 1` (which is 262143)

Since a Reference is stored in Value which is a Variant that also
stores a pointer, the size of Value is already 64-bit. So just don't
be clever here.

Makes pdf_reference_1-7.pdf get a bit further during decryption.
2023-07-10 17:48:15 +01:00
Ben Wiederhake
d344253b08 LibPDF: Extract reference bitpacking into dedicated class 2021-09-20 17:39:36 +04:30