--- old/src/java.base/share/native/libzip/zip_util.c Wed Oct 14 14:09:50 2015 +++ new/src/java.base/share/native/libzip/zip_util.c Wed Oct 14 14:09:50 2015 @@ -1302,12 +1302,23 @@ jint ZIP_Read(jzfile *zip, jzentry *entry, jlong pos, void *buf, jint len) { - jlong entry_size = (entry->csize != 0) ? entry->csize : entry->size; + jlong entry_size; jlong start; + if (zip == 0) { + return -1; + } + /* Clear previous zip error */ zip->msg = NULL; + if (entry == 0) { + zip->msg = "ZIP_Read: jzentry is NULL"; + return -1; + } + + entry_size = (entry->csize != 0) ? entry->csize : entry->size; + /* Check specified position */ if (pos < 0 || pos > entry_size - 1) { zip->msg = "ZIP_Read: specified offset out of range"; @@ -1440,6 +1451,11 @@ char *msg; char tmpbuf[1024]; + if (entry == 0) { + jio_fprintf(stderr, "jzentry was invalid"); + return JNI_FALSE; + } + strcpy(entryname, entry->name); if (entry->csize == 0) { /* Entry is stored */