From 4bc434000c42a7191e705c8a38216ca6743ad9ff Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Thu, 17 Jan 2019 08:50:19 -0500 Subject: Copy subdictionaries when removing resources (fixes #276) When removing unreferenced resources, the code was copying the overall resource dictionaries but not the subdictionaries being modified. This was a "typo" in the code -- the comment clearly stated the need to do this, but the code replaced the dictionary with itself rather than with a shallow copy of itself. --- libqpdf/QPDFPageObjectHelper.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'libqpdf') diff --git a/libqpdf/QPDFPageObjectHelper.cc b/libqpdf/QPDFPageObjectHelper.cc index 611f33ea..ba647372 100644 --- a/libqpdf/QPDFPageObjectHelper.cc +++ b/libqpdf/QPDFPageObjectHelper.cc @@ -156,6 +156,7 @@ QPDFPageObjectHelper::removeUnreferencedResources() { continue; } + dict = dict.shallowCopy(); resources.replaceKey(*d_iter, dict); std::set keys = dict.getKeys(); for (std::set::iterator k_iter = keys.begin(); -- cgit v1.2.3-54-g00ecf