Commit bd79138c841c0076f7f45ae9a530f480aeec2633
1 parent
a7ef572c
Treat direct page as runtime rather than logic error (fuzz issue 27393)
Showing
3 changed files
with
11 additions
and
3 deletions
ChangeLog
| 1 | +2020-11-11 Jay Berkenbilt <ejb@ql.org> | ||
| 2 | + | ||
| 3 | + * Treat a direct page object as a runtime error rather than a | ||
| 4 | + logic error since it is actually possible to create a file that | ||
| 5 | + has this (fuzz issue 27393). | ||
| 6 | + | ||
| 1 | 2020-11-09 Jay Berkenbilt <ejb@ql.org> | 7 | 2020-11-09 Jay Berkenbilt <ejb@ql.org> |
| 2 | 8 | ||
| 3 | * Handle "." appearing in --pages not preceded by a numeric range | 9 | * Handle "." appearing in --pages not preceded by a numeric range |
fuzz/qpdf_extra/27393.fuzz
0 → 100644
No preview for this file type
libqpdf/QPDFObjectHandle.cc
| @@ -1512,9 +1512,11 @@ QPDFObjectHandle::coalesceContentStreams() | @@ -1512,9 +1512,11 @@ QPDFObjectHandle::coalesceContentStreams() | ||
| 1512 | { | 1512 | { |
| 1513 | // Should not be possible for a page object to not have an | 1513 | // Should not be possible for a page object to not have an |
| 1514 | // owning PDF unless it was manually constructed in some | 1514 | // owning PDF unless it was manually constructed in some |
| 1515 | - // incorrect way. | ||
| 1516 | - throw std::logic_error("coalesceContentStreams called on object" | ||
| 1517 | - " with no associated PDF file"); | 1515 | + // incorrect way. However, it can happen in a PDF file whose |
| 1516 | + // page structure is direct, which is against spec but still | ||
| 1517 | + // possible to hand construct, as in fuzz issue 27393. | ||
| 1518 | + throw std::runtime_error("coalesceContentStreams called on object" | ||
| 1519 | + " with no associated PDF file"); | ||
| 1518 | } | 1520 | } |
| 1519 | QPDFObjectHandle new_contents = newStream(qpdf); | 1521 | QPDFObjectHandle new_contents = newStream(qpdf); |
| 1520 | this->replaceKey("/Contents", new_contents); | 1522 | this->replaceKey("/Contents", new_contents); |