Loading changes/ticket40739 0 → 100644 +3 −0 Original line number Diff line number Diff line o Minor features (debugging, compression): - Log the input and output buffer sizes when we detect a potential compression bomb. Diagnostic for ticket 40739. src/lib/compress/compress.c +9 −1 Original line number Diff line number Diff line Loading @@ -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 Loading src/test/test_util.c +1 −1 Original line number Diff line number Diff line Loading @@ -2945,7 +2945,7 @@ test_util_gzip_compression_bomb(void *arg) tt_int_op(-1, OP_EQ, tor_compress(&result, &result_len, one_mb, one_million, ZLIB_METHOD)); expect_single_log_msg_containing( expect_log_msg_containing( "We compressed something and got an insanely high " "compression factor; other Tors would think this " "was a compression bomb."); Loading Loading
changes/ticket40739 0 → 100644 +3 −0 Original line number Diff line number Diff line o Minor features (debugging, compression): - Log the input and output buffer sizes when we detect a potential compression bomb. Diagnostic for ticket 40739.
src/lib/compress/compress.c +9 −1 Original line number Diff line number Diff line Loading @@ -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 Loading
src/test/test_util.c +1 −1 Original line number Diff line number Diff line Loading @@ -2945,7 +2945,7 @@ test_util_gzip_compression_bomb(void *arg) tt_int_op(-1, OP_EQ, tor_compress(&result, &result_len, one_mb, one_million, ZLIB_METHOD)); expect_single_log_msg_containing( expect_log_msg_containing( "We compressed something and got an insanely high " "compression factor; other Tors would think this " "was a compression bomb."); Loading