From 6883a9c80752a1549674ffa0c88dea9b517d7e51 Mon Sep 17 00:00:00 2001 From: m-holger Date: Thu, 6 Feb 2025 19:57:30 +0000 Subject: [PATCH] In Pl_RunLength apply memory limit before and after decoding --- libqpdf/Pl_RunLength.cc | 3 +++ 1 file changed, 3 insertions(+), 0 deletions(-) diff --git a/libqpdf/Pl_RunLength.cc b/libqpdf/Pl_RunLength.cc index 0608025..963dbd9 100644 --- a/libqpdf/Pl_RunLength.cc +++ b/libqpdf/Pl_RunLength.cc @@ -156,6 +156,9 @@ Pl_RunLength::finish() unsigned char ch = 128; next()->write(&ch, 1); } else { + if (memory_limit && (m->out.size()) > memory_limit) { + throw std::runtime_error("Pl_RunLength memory limit exceeded"); + } next()->writeString(m->out); } next()->finish(); -- libgit2 0.21.4