From 5187a3ec85f1a83cbde9e77227e215a2dbcfccb0 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 17 Aug 2019 22:27:55 -0400 Subject: Shallow copy arrays without removing sparseness --- libqpdf/QPDFObjectHandle.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libqpdf/QPDFObjectHandle.cc') diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index cd03ef1c..3fa0266c 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -2340,7 +2340,10 @@ QPDFObjectHandle::shallowCopy() if (isArray()) { QTC::TC("qpdf", "QPDFObjectHandle shallow copy array"); - new_obj = newArray(getArrayAsVector()); + // No newArray for shallow copying the sparse array + QPDF_Array* arr = dynamic_cast(m->obj.getPointer()); + new_obj = QPDFObjectHandle( + new QPDF_Array(arr->getElementsForShallowCopy())); } else if (isDictionary()) { -- cgit v1.2.3-54-g00ecf