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

Runtime check to ensure PDF::Reader::Stream#hash is always a Hash #464

Closed yob closed 2 years ago

yob commented 2 years ago

Corrupt PDFs (like those generated by the fuzzer) might have an invalid type as the header object. We can't work with them - we need the Hash to fetch :Length and other properties. Best just to fail early and raise a MalformedPDFError