Bug#968354: xpdf crash with empty document
> On Debian Bullseye this crashes xpdf with coredump:
> touch x.pdf; xpdf x.pdf
This is a Poppler bug: they've added some more sanity checks to
PDFDoc::setup, including one to catch empty files, but not all of them
set errCode correctly.
I've submitted a fix to Poppler upstream:
https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/755
And I've added a workaround in xpopple:
--- xpdf/PDFCore.cc
+++ xpdf/PDFCore.cc
@@ -176,6 +176,13 @@ int PDFCore::loadFile2(PDFDoc *newDoc) {
// open the PDF file
if (!newDoc->isOk()) {
err = newDoc->getErrorCode();
+
+ // Work around a Poppler bug: some additional checks were added to
+ // PDFDoc::setup that don't set errCode
+ if (err == errNone) {
+ err = errDamaged;
+ }
+
delete newDoc;
return err;
}
Thanks very much,
--
Adam Sampson <ats@offog.org> <http://offog.org/>
Reply to: