aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2023-06-20 17:40:54 +0000
committerMike Perry <mikeperry-git@torproject.org>2023-06-22 23:12:34 +0000
commit796e65e487f6e98329992e5bb94e6c4e075b2361 (patch)
tree76a31c70ce655d79517c5efb51bf2495befc1496 /src/test
parent633355a88e9c1f5b793e601e43e49b5cbb1fb731 (diff)
downloadtor-796e65e487f6e98329992e5bb94e6c4e075b2361.tar.gz
tor-796e65e487f6e98329992e5bb94e6c4e075b2361.zip
Bug 40569: Reduce accepted range for negotiated cc_sendme_inc
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test_hs_descriptor.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/src/test/test_hs_descriptor.c b/src/test/test_hs_descriptor.c
index d96048a0f6..fe9bc24fb2 100644
--- a/src/test/test_hs_descriptor.c
+++ b/src/test/test_hs_descriptor.c
@@ -914,30 +914,21 @@ test_validate_sendme(void *arg)
{
(void)arg;
- /* Test basic operation: factors of 2X in either direction are OK */
+ /* Test basic operation: +/- 1 in either direction are OK */
cc_sendme_inc = 31;
- tt_assert(congestion_control_validate_sendme_increment(15));
- tt_assert(congestion_control_validate_sendme_increment(62));
+ tt_assert(congestion_control_validate_sendme_increment(30));
+ tt_assert(congestion_control_validate_sendme_increment(32));
- /* Test basic operation: Exceeding 2X fails */
+ /* Test basic operation: Exceeding +/- 1 fails */
cc_sendme_inc = 31;
- tt_assert(!congestion_control_validate_sendme_increment(14));
- tt_assert(!congestion_control_validate_sendme_increment(63));
+ tt_assert(!congestion_control_validate_sendme_increment(29));
+ tt_assert(!congestion_control_validate_sendme_increment(33));
/* Test potential overflow conditions */
- cc_sendme_inc = 129;
+ cc_sendme_inc = 254;
tt_assert(congestion_control_validate_sendme_increment(255));
- tt_assert(congestion_control_validate_sendme_increment(64));
- tt_assert(!congestion_control_validate_sendme_increment(63));
-
- cc_sendme_inc = 127;
- tt_assert(!congestion_control_validate_sendme_increment(255));
- tt_assert(congestion_control_validate_sendme_increment(254));
-
- cc_sendme_inc = 255;
- tt_assert(congestion_control_validate_sendme_increment(255));
- tt_assert(congestion_control_validate_sendme_increment(127));
- tt_assert(!congestion_control_validate_sendme_increment(126));
+ tt_assert(congestion_control_validate_sendme_increment(253));
+ tt_assert(!congestion_control_validate_sendme_increment(252));
/* Test 0 case */
cc_sendme_inc = 1;