-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Description
From the documentation, it doesn't appear that there is any way to limit zlib's inflate methods max uncompressed size?
Without a way to limit the maximum amount of data to be uncompressed, Node's zlib inflate methods could be vulnerable to zip bombs, where a few megabytes of input could result in hundreds of megabytes of uncompressed data.
For parsers such as https://github.com/thejoshwolfe/yauzl, which parse the zip format, and which know the compressed and uncompressed sizes exactly, ahead of time, it should be possible to pass this information on to zlib's inflate methods, so that these can stop when they uncompress more than the zip container allows.
zlib's inflate methods should throw an error when more than maxUncompressedSize
has been inflated.
See also: thejoshwolfe/yauzl#107