RFR [8043507]: javax.smartcardio.CardTerminals.list() fails on MacOSX

Valerie (Yu-Ching) Peng valerie.peng at oracle.com
Wed May 21 23:13:12 UTC 2014


Looks good.

Have you looked for similar problems in the code? I wonder if this is 
the only occurrence.

Thanks,
Valerie

On 05/20/14 04:00, Ivan Gerasimov wrote:
> Hello!
>
> The function javax.smartcardio.CardTerminals.list() sometimes fails 
> when called from an app running on MacOSX.
> The problem is due to that CALL_SCardListReaders(_, _, _, &size) 
> expects the size variable to be of size uint32_t on os x, but we 
> provide a pointer to 64 bit int instead.
> As a result, the higher bits may contain garbage upon return, and we 
> try to allocate a too large block of memory.
>
> The simplest solution is to initialize 'size' to zero before the call.
>
> No new tests with the fix, as the exiting tests already demonstrate 
> intermittent failures because of this bug.
>
> For example, I've seem how ./sun/security/smartcardio/TestDefault.java 
> failed once on every few hundred runs.
> With the fix this test doesn't fail even when running in a loop with 
> thousands of iterations.
>
> Would you please review this simple fix?
>
> BUGURL: https://bugs.openjdk.java.net/browse/JDK-8043507
> WEBREV: http://cr.openjdk.java.net/~igerasim/8043507/0/webrev/
>
> Sincerely yours,
> Ivan




More information about the security-dev mailing list