summaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QPDF.cc17
1 files changed, 6 insertions, 11 deletions
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
index 64ff4715..ebb5ff30 100644
--- a/libqpdf/QPDF.cc
+++ b/libqpdf/QPDF.cc
@@ -1344,21 +1344,16 @@ QPDF::readObject(
size_t length = 0;
try {
- std::map<std::string, QPDFObjectHandle> dict = object.getDictAsMap();
+ auto length_obj = object.getKey("/Length");
- if (dict.count("/Length") == 0) {
- QTC::TC("qpdf", "QPDF stream without length");
- throw damagedPDF(input, offset, "stream dictionary lacks /Length key");
- }
-
- QPDFObjectHandle length_obj = dict["/Length"];
if (!length_obj.isInteger()) {
+ if (length_obj.isNull()) {
+ QTC::TC("qpdf", "QPDF stream without length");
+ throw damagedPDF(input, offset, "stream dictionary lacks /Length key");
+ }
QTC::TC("qpdf", "QPDF stream length not integer");
throw damagedPDF(
- input,
- offset,
- "/Length key in stream dictionary is not "
- "an integer");
+ input, offset, "/Length key in stream dictionary is not an integer");
}
length = toS(length_obj.getUIntValue());