RFR : javax.smartcardio.CardTerminals.list() fails on MacOSX
ivan.gerasimov at oracle.com
Tue May 20 11:00:46 UTC 2014
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?
More information about the security-dev