aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_Stream.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-11-02 22:54:10 +0100
committerJay Berkenbilt <ejb@ql.org>2021-11-03 14:43:17 +0100
commit532a4f3d60f6981b22beb32e6ff688ec41f87e26 (patch)
tree73800f3a6da80171152df8c9236ce390bcd581f4 /libqpdf/QPDF_Stream.cc
parentc491d9f6af8dd2ecfbc5bd70b2054e03ac2521ac (diff)
downloadqpdf-532a4f3d60f6981b22beb32e6ff688ec41f87e26.tar.zst
Detect recoverable but invalid zlib data streams (fixes #562)
Diffstat (limited to 'libqpdf/QPDF_Stream.cc')
-rw-r--r--libqpdf/QPDF_Stream.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/libqpdf/QPDF_Stream.cc b/libqpdf/QPDF_Stream.cc
index bc3b1b56..14659008 100644
--- a/libqpdf/QPDF_Stream.cc
+++ b/libqpdf/QPDF_Stream.cc
@@ -503,6 +503,14 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline, bool* filterp,
{
pipeline = decode_pipeline;
}
+ Pl_Flate* flate = dynamic_cast<Pl_Flate*>(pipeline);
+ if (flate != nullptr)
+ {
+ flate->setWarnCallback([this](char const* msg, int code) {
+ warn(QPDFExc(qpdf_e_damaged_pdf, qpdf->getFilename(),
+ "", this->offset, msg));
+ });
+ }
}
}