RFR: 8377924: Inconsistent parsing of XBM files after JDK-8361748
Alexey Ivanov
aivanov at openjdk.org
Tue Feb 17 21:48:38 UTC 2026
[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`.
-------------
Commit messages:
- 8377924: Inconsistent parsing of XBM files after JDK-8361748
Changes: https://git.openjdk.org/jdk/pull/29769/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29769&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8377924
Stats: 162 lines in 12 files changed: 144 ins; 7 del; 11 mod
Patch: https://git.openjdk.org/jdk/pull/29769.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/29769/head:pull/29769
PR: https://git.openjdk.org/jdk/pull/29769
More information about the client-libs-dev
mailing list