commit 2e903b4ed5d99dea9569ca96a7c1a39a6db6fc88
parent 33df09ce6b7ee3563c8a979045add160049169cd
Author: Waldemar Zimpel <w.zimpel@dev.utilizer.de>
Date: Thu, 14 Aug 2025 23:41:27 +0200
Logging / Compression
Add compression factor to the "Detected possible compression bomb ..."
warning.
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/lib/compress/compress.c b/src/lib/compress/compress.c
@@ -66,11 +66,13 @@ tor_compress_is_compression_bomb,(size_t size_in, size_t size_out))
if (size_in == 0 || size_out < CHECK_FOR_COMPRESSION_BOMB_AFTER)
return 0;
- if (size_out / size_in > MAX_UNCOMPRESSION_FACTOR) {
+ double compression_factor = (double)size_out / size_in;
+ if (compression_factor > MAX_UNCOMPRESSION_FACTOR) {
log_warn(LD_GENERAL,
"Detected possible compression bomb with "
- "input size = %"TOR_PRIuSZ " and output size = %"TOR_PRIuSZ,
- size_in, size_out);
+ "input size = %"TOR_PRIuSZ" and output size = %"TOR_PRIuSZ" "
+ "(compression factor = %.2f)",
+ size_in, size_out, compression_factor);
return 1;
}