aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/Pl_ASCII85Decoder.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-01-04 17:55:28 +0100
committerJay Berkenbilt <ejb@ql.org>2021-01-04 21:17:35 +0100
commitdc92574c10f3e2516ec6445b88c5d584f40df4e5 (patch)
tree221eca0c948b2a19d7735027e514459694fca7dd /libqpdf/Pl_ASCII85Decoder.cc
parenta9bdeeb0e0059cf702f63c04affbcb56ecc8a29e (diff)
downloadqpdf-dc92574c10f3e2516ec6445b88c5d584f40df4e5.tar.zst
Fix some pipelines to be safe if downstream write fails (fuzz issue 28262)
Diffstat (limited to 'libqpdf/Pl_ASCII85Decoder.cc')
-rw-r--r--libqpdf/Pl_ASCII85Decoder.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/libqpdf/Pl_ASCII85Decoder.cc b/libqpdf/Pl_ASCII85Decoder.cc
index b8df3e87..9d9f6704 100644
--- a/libqpdf/Pl_ASCII85Decoder.cc
+++ b/libqpdf/Pl_ASCII85Decoder.cc
@@ -119,10 +119,13 @@ Pl_ASCII85Decoder::flush()
QTC::TC("libtests", "Pl_ASCII85Decoder partial flush",
(this->pos == 5) ? 0 : 1);
- getNext()->write(outbuf, this->pos - 1);
-
+ // Reset before calling getNext()->write in case that throws an
+ // exception.
+ auto t = this->pos - 1;
this->pos = 0;
memset(this->inbuf, 117, 5);
+
+ getNext()->write(outbuf, t);
}
void