8271987: Manifest improved manifest entries

Reviewed-by: rhalade, dholmes
This commit is contained in:
Harold Seigel 2021-09-02 18:09:33 +00:00 committed by Henry Jen
parent 5832a34404
commit 4be02d3155

View file

@ -303,13 +303,19 @@ u1* ClassPathZipEntry::open_entry(JavaThread* current, const char* name, jint* f
}
// read contents into resource array
int size = (*filesize) + ((nul_terminate) ? 1 : 0);
size_t size = (uint32_t)(*filesize);
if (nul_terminate) {
if (sizeof(size) == sizeof(uint32_t) && size == UINT_MAX) {
return NULL; // 32-bit integer overflow will occur.
}
size++;
}
buffer = NEW_RESOURCE_ARRAY(u1, size);
if (!(*ReadEntry)(_zip, entry, buffer, filename)) return NULL;
// return result
if (nul_terminate) {
buffer[*filesize] = 0;
buffer[size - 1] = 0;
}
return buffer;
}