Commit 94e86e252843e500fe3ef750203bfa7d31cab4ce
1 parent
8721f189
Fix fuzz issue 16301
Showing
2 changed files
with
12 additions
and
0 deletions
fuzz/qpdf_extra/16301.fuzz
0 → 100644
libqpdf/QPDFObjectHandle.cc
| @@ -2310,6 +2310,11 @@ QPDFObjectHandle::newStream(QPDF* qpdf, int objid, int generation, | @@ -2310,6 +2310,11 @@ QPDFObjectHandle::newStream(QPDF* qpdf, int objid, int generation, | ||
| 2310 | QPDFObjectHandle | 2310 | QPDFObjectHandle |
| 2311 | QPDFObjectHandle::newStream(QPDF* qpdf) | 2311 | QPDFObjectHandle::newStream(QPDF* qpdf) |
| 2312 | { | 2312 | { |
| 2313 | + if (qpdf == 0) | ||
| 2314 | + { | ||
| 2315 | + throw std::runtime_error( | ||
| 2316 | + "attempt to create stream in null qpdf object"); | ||
| 2317 | + } | ||
| 2313 | QTC::TC("qpdf", "QPDFObjectHandle newStream"); | 2318 | QTC::TC("qpdf", "QPDFObjectHandle newStream"); |
| 2314 | QPDFObjectHandle stream_dict = newDictionary(); | 2319 | QPDFObjectHandle stream_dict = newDictionary(); |
| 2315 | QPDFObjectHandle result = qpdf->makeIndirectObject( | 2320 | QPDFObjectHandle result = qpdf->makeIndirectObject( |