File poppler-CVE-2025-32365.patch of Package poppler.38203

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 | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Index: poppler-23.01.0/poppler/JBIG2Stream.cc
===================================================================
--- poppler-23.01.0.orig/poppler/JBIG2Stream.cc
+++ poppler-23.01.0/poppler/JBIG2Stream.cc
@@ -770,6 +770,9 @@ void JBIG2Bitmap::combine(JBIG2Bitmap *b
     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;
@@ -2200,9 +2203,7 @@ void JBIG2Stream::readTextRegionSeg(unsi
             if (pageH == 0xffffffff && y + h > curPageH) {
                 pageBitmap->expand(y + h, pageDefPixel);
             }
-            if (pageBitmap->isOk()) {
-                pageBitmap->combine(bitmap.get(), x, y, extCombOp);
-            }
+            pageBitmap->combine(bitmap.get(), x, y, extCombOp);
 
             // store the region bitmap
         } else {
openSUSE Build Service is sponsored by