RFR (S) 6671508 - JNI GetPrimitiveArrayCritical should not be callable on object arrays
David Holmes
david.holmes at oracle.com
Mon Jul 8 05:14:26 PDT 2013
Hi David,
Silly question but what the heck is a "typeArray" meant to be? Is it a
primitive array ?? If so we should at least use that terminology in the
error message! (I couldn't see a clear definition anywhere other than
typeArray is not objArray - which implies it is a primitive array).
I must admit I don't like the use of negative elementType values as a
means to encode what type of checks to perform, or not perform. I'd much
rather see simple clear checks:
- check_is_array
- check_array_element_type
- check_is_obj_array
- check_is_primitive_array
etc.
I had to keep re-reading the code to get the sense of the checks correct.
Thanks,
David
On 8/07/2013 9:19 PM, David Simms wrote:
> |Please review a small fix:||
>
> |http://cr.openjdk.java.net/~dsimms/6671508/
> <http://cr.openjdk.java.net/%7Edsimms/6671508/>
>
> Bug:
>
> https://jbs.oracle.com/bugs/browse/JDK-6671508||
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6671508
>
> |Summary of fix:||
> ||
> As noted in the bug, standard use of JNI does not protect the user
> from abusing the API (e.g. supplying incorrect arguments).
> The preferred method to discover such errors is via "checked JNI"
> (i.e. -Xcheck:jni).
> Added a further constant to "check_array()" to enforce primitive
> type array arg checking for Get/ReleasePrimativeArrayCritical.
>
> coleenp has already reviewed and okayed the fix (but is currently
> on vacation).
> ||
> ||Tests:||
> ||
> * JPRT
> * UTE "vm.quick.testlist"
> * JCK "vm_jni"
> ||
> ||Thanks||
> ||/David Simms||
> ||
> |
More information about the hotspot-runtime-dev
mailing list