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

Reply via email to