From c729e07d55c870e7e08f158f0a80a3d452c59cdc Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 21 Feb 2015 17:40:41 -0500 Subject: Avoid resolving arguments to R When checking two objects preceding R while parsing, ensure that the objects are direct. This avoids stuff like 1 0 obj containing 1 0 R 0 R from causing an infinite loop in object resolution. --- libqpdf/QPDFObjectHandle.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libqpdf') diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index eec4fae3..64a4e3c3 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -966,7 +966,9 @@ QPDFObjectHandle::parseInternal(PointerHolder input, std::string const& value = token.getValue(); if ((value == "R") && (in_array || in_dictionary) && (olist.size() >= 2) && + (! olist.at(olist.size() - 1).isIndirect()) && (olist.at(olist.size() - 1).isInteger()) && + (! olist.at(olist.size() - 2).isIndirect()) && (olist.at(olist.size() - 2).isInteger())) { if (context == 0) -- cgit v1.2.3-70-g09d2