[foreign-abi] RFR: 8240173: Confusing overflow error when trying to dereference a nothing segment

Paul Sandoz paul.sandoz at oracle.com
Thu Feb 27 16:55:46 UTC 2020


Looks good.

This started to make me wonder whether this “nothing” segment is really an “untrusted” segment, which could even have a bound.  It does represent something, but that something cannot be fully trusted and as such its contents cannot from be accessed within Java code.

Paul.

> On Feb 27, 2020, at 4:45 AM, Maurizio Cimadamore <mcimadamore at openjdk.java.net> wrote:
> 
> This simple patch attempts to generate a more explicit error message when trying to dereference an address which is based on the Nothing segment. Note that the first problem here is caused by the fact that the Nothing segment is considered "small" - which means most of the real address values will fall outside its range. While we could simply fix that (which will improve the error message - from reporting an overflow during offset computation to report an access outside the bounds of the segment), I thought it was better to mark the Nothing segment as non-accessible, and generate an explicit error message.
> 
> -------------
> 
> Commits:
> - d3ea2ea0: Clarify exception message when clients attempt to dereference the Nothing segment.
> 
> Changes: https://git.openjdk.java.net/panama-foreign/pull/34/files
> Webrev: https://webrevs.openjdk.java.net/panama-foreign/34/webrev.00
>  Issue: https://bugs.openjdk.java.net/browse/JDK-8240173
>  Stats: 30 lines in 3 files changed: 21 ins; 0 del; 9 mod
>  Patch: https://git.openjdk.java.net/panama-foreign/pull/34.diff
>  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/34/head:pull/34
> 
> PR: https://git.openjdk.java.net/panama-foreign/pull/34



More information about the panama-dev mailing list