Ghostscript 10.0.2 failed to handle the files changed in this commit,
but ghostscript 10.0.4 handles them fine as do earlier versions. These
files all have hybird xref in the form of a file with an xref table
appended with a section that has an xref stream. They all have
/PageLabels pointing to 107 0 R in the original file, with 107 higher
than the highest object. The spec says that this should be treated as
null, which results in /PageLabels null, which results in ghostscript
errors in that version. While ghostscript 10.0.2 may be handling the
file incorrectly, the file does something that's not really kosher,
and it's easier to fix the files, which had not been changed since the
very first open source release of qpdf, than to try to work around the
issue.
This was discovered with the GitHub actions runner was bumped to
Ubuntu 24.04, which contains the buggy version of ghostscript. I was
not able to find a specific ghostscript issue that addressed this, but
the problem went away in either 10.0.3 or 10.0.4.
Commenting out /PageLabels without changing offsets was a pragmatic
move to avoid having to regenerate the xref tables manually. I just
had to manually edit the binary xref stream to change the offset of
one item (the new object 1), which I put at the end to avoid breaking
other things.
Why did this ever work? Hard to say...perhaps a library we linked
against was setting `int _dowildcard = -1;` somewhere and no longer
is. Apparently linking with CRT_glob.o has been the way to do this for
a very long time, and we've just been lucky that it worked all this
time.
Return results rather than using reference parameters.
Fixes bug in #1272 where parameters were not reinitialized when calling
read_bad_entry from read_entry.
Currently, QPDFParser gives up attempting to parse an object if 5
near-consecutive bad tokens are encountered. Add a limit of a total of 15
bad tokens in a single object before giving up.
Optimistically read subsection headers without reading individual object
entries, assuming that they are 20 bytes long as per the PDF spec. If
problems are encountered, fall back to calling bad_subsections.