fix(zip): check uncompressed size exceeds the maximum value of an integer (PR #2773)

* check whether it exceeds the maximum value of an integer
---------

Co-authored-by: skylot <118523+skylot@users.noreply.github.com>
This commit is contained in:
Ruffalo Lavoisier
2026-02-05 05:29:16 +09:00
committed by GitHub
parent d73455c689
commit 039900a278
@@ -15,6 +15,9 @@ final class ZipDeflate {
buf.position(entry.getDataStart());
ByteBuffer entryBuf = buf.slice();
entryBuf.limit((int) entry.getCompressedSize());
if (entry.getUncompressedSize() > Integer.MAX_VALUE) {
throw new DataFormatException("Entry too large: " + entry.getUncompressedSize());
}
byte[] out = new byte[(int) entry.getUncompressedSize()];
Inflater inflater = new Inflater(true);
inflater.setInput(entryBuf);