RFR: 8373447: Suspicious sign extension after integer promotion in imageDecompressor.cpp:115 (ID: 51676)

Chen Liang liach at openjdk.org
Thu Dec 18 18:18:29 UTC 2025


The bitwise manipulation code in ImageDecompressor::getU8 and getU4 utilizes implicit conversion to signed int for bitwise or, making this code confusing, especially when the most significant bytes are explicitly converted to unsigned long long, and unsigned long long takes part in a bitwise or with int. We should convert all u1 to u8/u4 before shifts to make the code easier to maintain and understand.

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

Commit messages:
 - Yeat
 - Explicitly convert values for shifts and bitwise or

Changes: https://git.openjdk.org/jdk/pull/28903/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28903&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8373447
  Stats: 7 lines in 1 file changed: 0 ins; 0 del; 7 mod
  Patch: https://git.openjdk.org/jdk/pull/28903.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28903/head:pull/28903

PR: https://git.openjdk.org/jdk/pull/28903


More information about the core-libs-dev mailing list