Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4836743
Votes 0
Synopsis Backward compatibility - jni apps need to dereference bogus returned reference
Category hotspot:jni
Reported Against mantis-beta
Release Fixed 1.3.1_09
State 10-Fix Delivered, Verified, bug
Priority: 2-High
Related Bugs 4804447 , 4834329 , 4844193
Submit Date 24-MAR-2003
Description
Calls to the JNI function Get<type>ArrayElements() normally return a
pointer to a copy of the specified array.  Callers can use this pointer
to access elements of the array.  If the array is empty, there are no
elements to access, and the returned pointer should not be used.

The fix for bug 4804447 handled this special (empty array) case, by
returning a pointer to an invalid page.  Previously, a pointer to an
arbitrary block of memory (with zero data elements) was returned.  

Unfortunately, there are one or more customer applications which
(indirectly) rely on the initial zero bytes being present.  One customer
passes the zero length array to a Microsoft API (DirectDraw) which
accesses the first character in the zero length array.  This is clearly
a bug in the Microsoft code.  The VM needs to be compatible with this
buggy behavior to avoid breaking the customer's app.

A test case is attached.  Just compile and run.
Work Around
N/A
Evaluation
 xxxxx@xxxxx  2003-03-24
Valid problem, fix or not to fix?


 xxxxx@xxxxx  2003-03-24
Fix is simple, but requires a simple method be added for each OS supported.
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang