yob / pdf-reader

The PDF::Reader library implements a PDF parser conforming as much as possible to the PDF specification from Adobe.
MIT License
1.81k stars 271 forks source link

Make an effort to compensate when an xref offset is a few bytes too low #438

Closed yob closed 2 years ago

yob commented 2 years ago

A sample file provided in #213 has an xref table where at least one of the byte offsets is a few bytes too low. When we jump to that offset, we don't find the start of the object as we expect.

However, the following token in the file is the start of the expected object. Other readers I tested with seem to handle this particular corruption gracefully, and now we do too.

Fixes #213