From b5be61c5167d3d9dd000832b409e0b8d09d8bf43 Mon Sep 17 00:00:00 2001 From: m-holger Date: Sat, 2 Nov 2024 13:32:54 +0000 Subject: [PATCH] Use new read method in QPDF::pipeStreamData --- libqpdf/QPDF.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index cc54db29..8db62d9c 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -22,7 +23,6 @@ #include #include #include -#include #include #include @@ -980,12 +980,11 @@ QPDF::pipeStreamData( bool attempted_finish = false; try { - file->seek(offset, SEEK_SET); - auto buf = std::make_unique(length); - if (auto read = file->read(buf.get(), length); read != length) { - throw damagedPDF(*file, "", offset + toO(read), "unexpected EOF reading stream data"); + auto buf = file->read(length, offset); + if (buf.size() != length) { + throw damagedPDF(*file, "", offset + toO(buf.size()), "unexpected EOF reading stream data"); } - pipeline->write(buf.get(), length); + pipeline->write(buf.data(), length); attempted_finish = true; pipeline->finish(); return true;