RFR: 8378833: Improve offset arithmetic in ArraysSupport::mismatch
Some of the `ArraysSupport::mismatch` family of methods compute offsets using a mix of `int` and `long` arithmetic. This can lead to wrong results, which are then passed as arguments to an intrinsic method or to a Java method using `Unsafe`. ------------- Commit messages: - 8378833: Improve offset arithmetic in ArraysSupport::mismatch Changes: https://git.openjdk.org/jdk/pull/29957/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29957&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8378833 Stats: 13 lines in 1 file changed: 0 ins; 0 del; 13 mod Patch: https://git.openjdk.org/jdk/pull/29957.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/29957/head:pull/29957 PR: https://git.openjdk.org/jdk/pull/29957
On Fri, 27 Feb 2026 12:35:51 GMT, Raffaello Giulietti <rgiulietti@openjdk.org> wrote:
Some of the `ArraysSupport::mismatch` family of methods compute offsets using a mix of `int` and `long` arithmetic. This can lead to wrong results, which are then passed as arguments to an intrinsic method or to a Java method using `Unsafe`.
And this is exactly why the base offsets are statically typed long in the first place... ------------- Marked as reviewed by liach (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/29957#pullrequestreview-3866770156
On Fri, 27 Feb 2026 12:35:51 GMT, Raffaello Giulietti <rgiulietti@openjdk.org> wrote:
Some of the `ArraysSupport::mismatch` family of methods compute offsets using a mix of `int` and `long` arithmetic. This can lead to wrong results, which are then passed as arguments to an intrinsic method or to a Java method using `Unsafe`.
Marked as reviewed by alanb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/29957#pullrequestreview-3866933979
On Fri, 27 Feb 2026 12:35:51 GMT, Raffaello Giulietti <rgiulietti@openjdk.org> wrote:
Some of the `ArraysSupport::mismatch` family of methods compute offsets using a mix of `int` and `long` arithmetic. This can lead to wrong results, which are then passed as arguments to an intrinsic method or to a Java method using `Unsafe`.
looks good ------------- Marked as reviewed by rriggs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/29957#pullrequestreview-3867803491
On Fri, 27 Feb 2026 12:35:51 GMT, Raffaello Giulietti <rgiulietti@openjdk.org> wrote:
Some of the `ArraysSupport::mismatch` family of methods compute offsets using a mix of `int` and `long` arithmetic. This can lead to wrong results, which are then passed as arguments to an intrinsic method or to a Java method using `Unsafe`.
This pull request has now been integrated. Changeset: dbbb3b1a Author: Raffaello Giulietti <rgiulietti@openjdk.org> URL: https://git.openjdk.org/jdk/commit/dbbb3b1ac5fd218ed2b3c7247f6602a7a58ca4de Stats: 13 lines in 1 file changed: 0 ins; 0 del; 13 mod 8378833: Improve offset arithmetic in ArraysSupport::mismatch Reviewed-by: liach, alanb, rriggs ------------- PR: https://git.openjdk.org/jdk/pull/29957
participants (4)
-
Alan Bateman
-
Chen Liang
-
Raffaello Giulietti
-
Roger Riggs