[foreign] RFR 8218772: Limit struct member pointers to size of the field

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Feb 13 18:23:46 UTC 2019


More onto the review:

I think this method is quite performance sensitive, and allocating so 
many objects might be an issue. It was already bad, now limit() will 
cause another bunch of allocation to happen.

I wonder: can we just create a BoundedPointer with right type, offset 
and bound info from the start - instead of getting there in steps?

E.g.

return new BoundedPointer<>(ptr.scope(), type, <compute new boundinfo>, 
path.offset() / 8);

Maurizio



On 13/02/2019 15:47, Jorn Vernee wrote:
> Hi,
>
> I found a bug where it was possible to overwrite trailing fields of a 
> struct by writing an oversized array to a previous array field (see 
> bug). Overwriting is also possible in other cases by forcing an 
> oversized write to a struct field. This can be fixed (relatively 
> easily) by limiting the size of memory regions of pointers to struct 
> members to the size of their fields.
>
> Please review the following.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8218772
> Webrev: 
> http://cr.openjdk.java.net/~jvernee/panama/webrevs/8218772/webrev.00/
>
> Thanks,
> Jorn


More information about the panama-dev mailing list