Integrated: 8287244: Add bound check in indexed memory access var handle
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Thu May 26 08:38:43 UTC 2022
On Tue, 24 May 2022 14:40:56 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> Constructing indexed var handles using the `MemoryLayout` API produces `VarHandle` which do not check the input indices for out-of-bounds conditions.
> While this can never result in a VM crash (after all the memory segment will protect against "true" OOB access), it is still possible for an access expression to refer to parts of a segment that are logically unrelated.
>
> This patch adds a "logical" bound check to all indexed var handles generated using the layout API.
> Benchmarks are not affected by the check. Users are still able to create custom "unchecked" var handles, using the combinator API in `MethodHandles`.
This pull request has now been integrated.
Changeset: f58c9a65
Author: Maurizio Cimadamore <mcimadamore at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/f58c9a659ba181407ecdb2aacb81e6a7f1cbd9ff
Stats: 92 lines in 4 files changed: 70 ins; 5 del; 17 mod
8287244: Add bound check in indexed memory access var handle
Reviewed-by: psandoz, jvernee
-------------
PR: https://git.openjdk.java.net/jdk/pull/8868
More information about the core-libs-dev
mailing list