aboutsummaryrefslogtreecommitdiff
path: root/src/lib/compress
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2023-09-18 09:10:39 -0400
committerDavid Goulet <dgoulet@torproject.org>2023-09-18 09:10:39 -0400
commitcd2bc94c44c5b01044105ab4bd844e84bf2b163e (patch)
treefc8d7352a545a8ed6a53624b330b3d1103fa86ef /src/lib/compress
parentc24203cf31328c21169d3af87265d110ccc86080 (diff)
parentd9a6b37ab1597ac726e5f972ebfbccf024c58cbc (diff)
downloadtor-cd2bc94c44c5b01044105ab4bd844e84bf2b163e.tar.gz
tor-cd2bc94c44c5b01044105ab4bd844e84bf2b163e.zip
Merge branch 'tor-gitlab/mr/761' into maint-0.4.8
Diffstat (limited to 'src/lib/compress')
-rw-r--r--src/lib/compress/compress.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/compress/compress.c b/src/lib/compress/compress.c
index 83e63905cc..346e77f07d 100644
--- a/src/lib/compress/compress.c
+++ b/src/lib/compress/compress.c
@@ -66,7 +66,15 @@ 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;
- return (size_out / size_in > MAX_UNCOMPRESSION_FACTOR);
+ if (size_out / size_in > 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);
+ return 1;
+ }
+
+ return 0;
}
/** Guess the size that <b>in_len</b> will be after compression or