RFR: 8377924: Inconsistent parsing of XBM files after JDK-8361748

Dmitry Markov dmarkov at openjdk.org
Mon Feb 23 16:32:10 UTC 2026


On Tue, 17 Feb 2026 21:41:24 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

> [JDK-8361748](https://bugs.openjdk.org/browse/JDK-8361748 "Enforce limits on the size of an XBM image") and [JDK-8373727](https://bugs.openjdk.org/browse/JDK-8373727 "New XBM images parser regression: only the first line of the bitmap array is parsed") changed how XBM files are parsed, and now some of the valid XBM images are parsed inconsistently. For example,
> 
> 
> #define ht 1
> #define th 8
> k[] = {0xAB}; 
> 
> 
> is parsed as image of size 1×8 instead of 8×1 after JDK-8361748.
> 
> The above problem is addressed by [JDK-8373727](https://bugs.openjdk.org/browse/JDK-8373727). However, the code to differentiate between width and height differs from the original code that was used before [JDK-8361748](https://bugs.openjdk.org/browse/JDK-8361748). Due to this difference,
> 
> 
> #define ht 1
> #define h 8 
> 
> 
> is rejected: Invalid values for width or height.
> 
> Previously, `-h` was a marker for width, and `-ht` was for height.
> 
> https://github.com/openjdk/jdk/blob/fc807d0914c4d8d2a174410a35acf3520ff4e60a/src/java.desktop/share/classes/sun/awt/image/XbmImageDecoder.java#L109-L112
> 
> But [JDK-8373727](https://bugs.openjdk.org/browse/JDK-8373727) uses `-th` for width and `-t` for height.
> 
> https://github.com/openjdk/jdk/blob/7f707ba8e746d859ac171d71ef8f731953a92e6a/src/java.desktop/share/classes/sun/awt/image/XbmImageDecoder.java#L114-L118
> 
> For backward compatibility, we should revert to `-h` and `-ht`.

Marked as reviewed by dmarkov (Reviewer).

-------------

PR Review: https://git.openjdk.org/jdk/pull/29769#pullrequestreview-3842141992


More information about the client-libs-dev mailing list