mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Bug 40569: Reduce accepted range for negotiated cc_sendme_inc
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user