RFR : 8038491: Improve synchronization in ZipFile.read()

Seán Coffey sean.coffey at oracle.com
Tue Apr 8 15:21:11 UTC 2014


A recently reported bug shows a race condition is possible on the rem == 
0 check in ZipFile.read(byte b[], int off, int len). A bad check can 
result in referencing a jzentry structure that might already be freed 
and hence result in a SEGV. The fix is trivial and involves moving the 
rem == 0 check into a synchronized block. The ZipFile API itself is not 
thread safe so having mutiple threads operate on the same 
ZipFileInputStream is something that should never be performed.

webrev : http://cr.openjdk.java.net/~coffeys/webrev.8038491/webrev/

regards,
Sean.



More information about the core-libs-dev mailing list