[Poppler-bugs] [Bug 103552] New: Out of bounds memory read when loading zero-bytes PDF
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Thu Nov 2 23:01:02 UTC 2017
https://bugs.freedesktop.org/show_bug.cgi?id=103552
Bug ID: 103552
Summary: Out of bounds memory read when loading zero-bytes PDF
Product: poppler
Version: unspecified
Hardware: Other
OS: All
Status: NEW
Severity: normal
Priority: medium
Component: general
Assignee: poppler-bugs at lists.freedesktop.org
Reporter: simon-freedesktop at exyr.org
Steps to reproduce:
* Call poppler_document_new_from_data with data = (char*) 0x1 and len = 0
(0x1 is the dummy pointer that Rust uses when not allocating heap memory in a
zero-size vector of bytes Vec<u8>.)
Expected result:
* A null pointer is returned and an error is set
Actual result:
* Segfault because this method of MemStream:
int getChar() override
{ return (bufPtr < bufEnd) ? (*bufPtr++ & 0xff) : EOF; }
… dereferences a null pointer. It was entered with bufEnd == 0x1 (as expected)
and bufPtr == 0x0 (incorrect, should be 0x1).
It looks like this MemStream comes from str->makeSubStream() being called with
an incorrect start position of -1 in XRef::readXRef(). This value came from
getStartXRef() which apparently uses it to signal that "startxref" wasn’t
found. But the caller PDFDoc::setup() doesn’t check for that error and uses the
value as a position for the XRef constructor.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/poppler-bugs/attachments/20171102/105be241/attachment.html>
More information about the Poppler-bugs
mailing list