mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
test/protover: remove version zero from tests
This isn't legal according to dir-spec.txt. We can write separate tests for it if the spec is changed to make it legal.
This commit is contained in:
parent
ae1aea4cc4
commit
e9ef7d5ab4
@ -290,13 +290,13 @@ test_protover_all_supported(void *arg)
|
||||
tor_free(msg);
|
||||
|
||||
/* We shouldn't be able to DoS ourselves parsing a large range. */
|
||||
tt_assert(! protover_all_supported("Sleen=0-2147483648", &msg));
|
||||
tt_str_op(msg, OP_EQ, "Sleen=0-2147483648");
|
||||
tt_assert(! protover_all_supported("Sleen=1-2147483648", &msg));
|
||||
tt_str_op(msg, OP_EQ, "Sleen=1-2147483648");
|
||||
tor_free(msg);
|
||||
|
||||
/* This case is allowed. */
|
||||
tt_assert(! protover_all_supported("Sleen=0-4294967294", &msg));
|
||||
tt_str_op(msg, OP_EQ, "Sleen=0-4294967294");
|
||||
tt_assert(! protover_all_supported("Sleen=1-4294967294", &msg));
|
||||
tt_str_op(msg, OP_EQ, "Sleen=1-4294967294");
|
||||
tor_free(msg);
|
||||
|
||||
/* If we get a (barely) valid (but unsupported list, we say "yes, that's
|
||||
@ -313,7 +313,7 @@ test_protover_all_supported(void *arg)
|
||||
/* If we get a completely unparseable list, protover_all_supported should
|
||||
* hit a fatal assertion for BUG(entries == NULL). */
|
||||
tor_capture_bugs_(1);
|
||||
tt_assert(protover_all_supported("Sleen=0-4294967295", &msg));
|
||||
tt_assert(protover_all_supported("Sleen=1-4294967295", &msg));
|
||||
tor_end_capture_bugs_();
|
||||
|
||||
/* Protocol name too long */
|
||||
@ -548,11 +548,11 @@ test_protover_vote_roundtrip(void *args)
|
||||
{ "Zn=4294967295-1", NULL },
|
||||
{ "Zn=4294967293-4294967295", NULL },
|
||||
/* Will fail because of 4294967295. */
|
||||
{ "Foo=1,3 Bar=3 Baz= Quux=9-12,14,15-16,900 Zn=0,4294967295",
|
||||
{ "Foo=1,3 Bar=3 Baz= Quux=9-12,14,15-16,900 Zn=1,4294967295",
|
||||
NULL },
|
||||
{ "Foo=1,3 Bar=3 Baz= Quux=9-12,14,15-16,900 Zn=0,4294967294",
|
||||
"Bar=3 Foo=1,3 Quux=9-12,14-16,900 Zn=0,4294967294" },
|
||||
{ "Zu16=0,65536", "Zu16=0,65536" },
|
||||
{ "Foo=1,3 Bar=3 Baz= Quux=9-12,14,15-16,900 Zn=1,4294967294",
|
||||
"Bar=3 Foo=1,3 Quux=9-12,14-16,900 Zn=1,4294967294" },
|
||||
{ "Zu16=1,65536", "Zu16=1,65536" },
|
||||
{ "N-1=1,2", "N-1=1-2" },
|
||||
{ "-1=4294967295", NULL },
|
||||
{ "-1=3", "-1=3" },
|
||||
@ -581,9 +581,9 @@ test_protover_vote_roundtrip(void *args)
|
||||
{ "Sleen=1-501", "Sleen=1-501" },
|
||||
{ "Sleen=1-65537", NULL },
|
||||
/* Both C/Rust implementations should be able to handle this mild DoS. */
|
||||
{ "Sleen=0-2147483648", NULL },
|
||||
{ "Sleen=1-2147483648", NULL },
|
||||
/* Rust tests are built in debug mode, so ints are bounds-checked. */
|
||||
{ "Sleen=0-4294967295", NULL },
|
||||
{ "Sleen=1-4294967295", NULL },
|
||||
};
|
||||
unsigned u;
|
||||
smartlist_t *votes = smartlist_new();
|
||||
|
Loading…
Reference in New Issue
Block a user