From 8a9015bdd0e4d26c7c14b415895badd6607ed16b Mon Sep 17 00:00:00 2001 From: m-holger Date: Sun, 2 Nov 2025 13:08:26 +0000 Subject: [PATCH] Update `Stream::copy_data_to` to avoid unnecessary replacement filters and decode parameters with their existing values. --- libqpdf/QPDF_Stream.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libqpdf/QPDF_Stream.cc b/libqpdf/QPDF_Stream.cc index 0bd46c0..f77b6e3 100644 --- a/libqpdf/QPDF_Stream.cc +++ b/libqpdf/QPDF_Stream.cc @@ -311,9 +311,9 @@ Stream::copy_data_to(Stream& dest) if (qpdf()->doc().config().immediate_copy_from() && !s->stream_data) { // Pull the stream data into a buffer before attempting the copy operation. Do it on the // source stream so that if the source stream is copied multiple times, we don't have to - // keep duplicating the memory. - replaceStreamData( - getRawStreamData(), s->stream_dict["/Filter"], s->stream_dict["/DecodeParms"]); + // keep duplicating the memory. Passing uninitialised object handles will preserve the + // existing filters and decode parameters. + replaceStreamData(getRawStreamData(), {}, {}); } if (s->stream_data) { dest.replaceStreamData(s->stream_data, dict["/Filter"], dict["/DecodeParms"]); -- libgit2 0.21.4