--- old/src/share/native/com/sun/java/util/jar/pack/zip.cpp 2015-10-13 20:02:35.145189200 +0400 +++ new/src/share/native/com/sun/java/util/jar/pack/zip.cpp 2015-10-13 20:02:34.947066800 +0400 @@ -451,8 +451,11 @@ zs.avail_in = (int) read_gzin_fn(u, inbuf, 1, inbuflen); zs.next_in = (uchar*) inbuf; } - int error = inflate(&zs, Z_NO_FLUSH); - if (error != Z_OK && error != Z_STREAM_END) { + // When flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it + // will return Z_BUF_ERROR if it has not reached the end of the stream. + // So, the only normal return codes are Z_BUF_ERROR and Z_STREAM_END. + int error = inflate(&zs, Z_FINISH); + if (error != Z_BUF_ERROR && error != Z_STREAM_END) { u->abort("error inflating input"); break; }