Actually, I don't see how to defend this. Is there any way to ask a gzip file which size it will be once unzipped, without needing to decompress it?
The closest is uncompressing it and counting and immediately discarding the bytes in the output stream.
But of course the proper defense is to give up if you exceed a predefined memory or time budget.
Actually, I don't see how to defend this. Is there any way to ask a gzip file which size it will be once unzipped, without needing to decompress it?