From 1f151565bbca5be7449ba8eea6833051cc1baa41 Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Mon, 31 Mar 2025 14:35:49 +0200
Subject: [PATCH] Move isOk check to inside JBIG2Bitmap::combine

---
 poppler/JBIG2Stream.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index cf9e0c984..4e81d4a8c 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -862,6 +862,10 @@
   unsigned int src0, src1, src, dest, s1, s2, m1, m2, m3;
   bool oneByte;
 
+  if (unlikely(!isOk())) {
+    return;
+  }
+
   // check for the pathological case where y = -2^31
   if (y < -0x7fffffff) {
     return;
-- 
GitLab

