This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pdfbox-jbig2.git


The following commit(s) were added to refs/heads/master by this push:
     new ec8c4be  PDFBOX-6155: reset ArithmeticDecoder to reset state; interim 
fix
ec8c4be is described below

commit ec8c4be73db075b4a5d94bcc061a89b44d1f7f4a
Author: Maruan Sahyoun <[email protected]>
AuthorDate: Sat Apr 18 22:07:51 2026 +0200

    PDFBOX-6155: reset ArithmeticDecoder to reset state; interim fix
---
 .../java/org/apache/pdfbox/jbig2/segments/SymbolDictionary.java     | 6 ++++++
 src/test/java/org/apache/pdfbox/jbig2/SerenityTests.java            | 3 +--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/src/main/java/org/apache/pdfbox/jbig2/segments/SymbolDictionary.java 
b/src/main/java/org/apache/pdfbox/jbig2/segments/SymbolDictionary.java
index 390b311..2963074 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/segments/SymbolDictionary.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/segments/SymbolDictionary.java
@@ -661,6 +661,12 @@ public class SymbolDictionary implements Dictionary
             subInputStream.skipBits();
 
             streamPosition0 = subInputStream.getStreamPosition();
+
+            // 5) c) - Initialize arithmetic decoder for refinement bitmap
+            // Note that the same subInputStream is used for both symbol 
dictionary decoding
+            // and refinement bitmap decoding, so the arithmetic decoder must 
be re-initialized here.
+            // CXs and other parameters are retained, so only the arithmetic 
decoder needs to be re-initialized.
+            arithmeticDecoder = new ArithmeticDecoder(subInputStream);
         }
         else
         {
diff --git a/src/test/java/org/apache/pdfbox/jbig2/SerenityTests.java 
b/src/test/java/org/apache/pdfbox/jbig2/SerenityTests.java
index f3d32f3..cfe12b7 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/SerenityTests.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/SerenityTests.java
@@ -61,8 +61,7 @@ public class SerenityTests
             String name = file.getName();
             // Files that are not properly decoded yet
             if (name.equals("bitmap-refine-template1-tpgron.jbig2") ||
-                name.equals("bitmap-symbol-context-reuse.jbig2") ||
-                name.equals("bitmap-symbol-symhuffrefine-textrefine.jbig2"))
+                name.equals("bitmap-symbol-context-reuse.jbig2"))
             {
                 continue;
             }

Reply via email to