RFR: 8347334: JimageDiffGenerator code clean-ups [v2]
Severin Gehwolf
sgehwolf at openjdk.org
Thu Jan 9 18:25:16 UTC 2025
On Thu, 9 Jan 2025 17:44:05 GMT, Archie Cobbs <acobbs at openjdk.org> wrote:
>> Severin Gehwolf has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Review feedback
>
> src/jdk.jlink/share/classes/jdk/tools/jlink/internal/runtimelink/JimageDiffGenerator.java line 131:
>
>> 129: int bytesRead1, bytesRead2;
>> 130: try (is1; is2) {
>> 131: while ((bytesRead1 = is1.readNBytes(buf1, 0, buf1.length)) != 0) {
>
> If `in1` is exactly 1024 bytes, and `in2` is those same bytes plus one extra byte (1025 bytes), this method will return a false positive.
>
> Probably just want `while (true)` here, then read both `in1` and `in2`, then check results.
Good catch! Added a test for this case and fixed the code.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23014#discussion_r1909262927
More information about the core-libs-dev
mailing list