2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-05-29 00:10:54 +00:00

Use better error for getStreamData failure

If the stream isn't filterable but we call getStreamData, throw a
regular exception instead of a logic error so that normal error
handling and reporting mechanisms will be used.
This commit is contained in:
Jay Berkenbilt 2018-01-13 13:18:36 -05:00
parent 48864b8d6e
commit be27d47bdc
2 changed files with 7 additions and 2 deletions

View File

@ -96,7 +96,9 @@ QPDF_Stream::getStreamData(qpdf_stream_decode_level_e decode_level)
Pl_Buffer buf("stream data buffer");
if (! pipeStreamData(&buf, 0, decode_level, false, false))
{
throw std::logic_error("getStreamData called on unfilterable stream");
throw QPDFExc(qpdf_e_unsupported, qpdf->getFilename(),
"", this->offset,
"getStreamData called on unfilterable stream");
}
QTC::TC("qpdf", "QPDF_Stream getStreamData");
return buf.getBuffer();

View File

@ -4,4 +4,7 @@ WARNING: issue-148.pdf (xref stream: object 8 0, file position 73): attempting t
WARNING: issue-148.pdf (xref stream: object 8 0, file position 73): recovered stream length: 2
WARNING: issue-148.pdf (xref stream: object 8 0, file position 85): expected endobj
WARNING: issue-148.pdf (file position 73): error decoding stream data for object 8 0: stream inflate: inflate: data: incorrect header check
getStreamData called on unfilterable stream
WARNING: issue-148.pdf: file is damaged
WARNING: issue-148.pdf (file position 73): getStreamData called on unfilterable stream
WARNING: issue-148.pdf: Attempting to reconstruct cross-reference table
issue-148.pdf: unable to find trailer dictionary while recovering damaged file