< prev index next >

src/java.base/share/native/libzip/zip_util.c

Print this page

        

*** 1300,1315 **** * has the size bigger than 2**32 bytes in ONE invocation. */ jint ZIP_Read(jzfile *zip, jzentry *entry, jlong pos, void *buf, jint len) { ! jlong entry_size = (entry->csize != 0) ? entry->csize : entry->size; jlong start; /* Clear previous zip error */ zip->msg = NULL; /* Check specified position */ if (pos < 0 || pos > entry_size - 1) { zip->msg = "ZIP_Read: specified offset out of range"; return -1; } --- 1300,1326 ---- * has the size bigger than 2**32 bytes in ONE invocation. */ jint ZIP_Read(jzfile *zip, jzentry *entry, jlong pos, void *buf, jint len) { ! 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"; return -1; }
*** 1438,1447 **** --- 1449,1463 ---- ZIP_ReadEntry(jzfile *zip, jzentry *entry, unsigned char *buf, char *entryname) { 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 */ jlong pos = 0; jlong size = entry->size;
< prev index next >