mirror of
https://github.com/hanzoai/esbuild.git
synced 2026-09-24 16:58:50 +00:00
enforce non-negative size in gzip parser
This commit is contained in:
+1
-1
@@ -130,7 +130,7 @@ function extractFileFromTarGzip(buffer: Uint8Array, file: string): Uint8Array {
|
||||
let name = str(offset, 100)
|
||||
let size = parseInt(str(offset + 124, 12), 8)
|
||||
offset += 512
|
||||
if (!isNaN(size)) {
|
||||
if (!isNaN(size) && size >= 0) {
|
||||
if (name === file) return buffer.subarray(offset, offset + size)
|
||||
offset += (size + 511) & ~511
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ function extractFileFromTarGzip(buffer: Buffer, subpath: string): Buffer {
|
||||
let name = str(offset, 100)
|
||||
let size = parseInt(str(offset + 124, 12), 8)
|
||||
offset += 512
|
||||
if (!isNaN(size)) {
|
||||
if (!isNaN(size) && size >= 0) {
|
||||
if (name === subpath) return buffer.subarray(offset, offset + size)
|
||||
offset += (size + 511) & ~511
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user