Good points, I have updated the webrev accordingly.
The current callers of Java_sun_security_smartcardio_PCSC_SCardGetStatusChange seems to only pass 1 reader at a time, so I just moved the free call to a separate loop as part of cleanup.

Webrev is updated at: http://cr.openjdk.java.net/~valeriep/8030114/webrev.01/
Thanks,
Valerie

On 02/14/14 06:32, Florian Weimer wrote:
On 02/14/2014 01:30 AM, Valerie (Yu-Ching) Peng wrote:

Can someone please review the fixes which checks for pending exceptions
in native code "pcsc.c"?
The fix is straightforward for all except the changes under
Java_sun_security_smartcardio_PCSC_SCardGetStatusChange(...) method
which is somewhat complicated due to the need to free up memories.

Webrev: http://cr.openjdk.java.net/~valeriep/8030114/webrev.00/

It seems to me there is a slight behavioral change in Java_sun_security_smartcardio_PCSC_SCardStatus. I think the ArrayIndexOutofBoundsException is no longer thrown if the status array is too short.

The logic in Java_sun_security_smartcardio_PCSC_SCardGetStatusChange appears to be correct, but I wonder if it would be clearer to use calloc for allocation and avoid the interlocked i/j/k loop counters, at the cost of calling free on a few NULL pointers.



Reply via email to