Copilot commented on code in PR #6:
URL: https://github.com/apache/pdfbox-jbig2/pull/6#discussion_r4501350362


##########
src/main/java/org/apache/pdfbox/jbig2/segments/SymbolDictionary.java:
##########
@@ -385,7 +385,13 @@ public ArrayList<Bitmap> getDictionary()
         if (null == exportSymbols)
         {
             if (useRefinementAggregation)
+            {
                 sbSymCodeLen = getSbSymCodeLen();
+                if (sbSymCodeLen > 30)

Review Comment:
   The 30-bit limit is needed for the arithmetic path's `1 << sbSymCodeLen` 
allocation, but `resetIntegerCoderStatistics()` is skipped for Huffman 
dictionaries, whose symbol IDs are read with `readBits(sbSymCodeLen)`. A 
Huffman refinement dictionary with `0x40000001` symbols requires 31-bit IDs and 
has in-range array lengths, yet this new guard rejects it. Restrict the check 
to `!isHuffmanEncoded` so the overflow guard does not reject otherwise 
representable Huffman dictionaries.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to