commit 536b5c8059bc3356edb8687c423c5966a2729b6d
parent 92b4e4d04127bfdca4a3c869953e9fdf640729c7
Author: Nick Mathewson <nickm@torproject.org>
Date: Tue, 1 Mar 2022 11:22:34 -0500
connection_or_set_identity_digest(): Make errors nonfatal.
Previously we were using tor_assert() to enforce the documented
invariant here; this commit changes it to use BUG() instead. It
will protect us from crashes if the next commit (on #40563) turns
out to expose a bug somewhere.
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/core/or/connection_or.c b/src/core/or/connection_or.c
@@ -182,8 +182,10 @@ connection_or_set_identity_digest(or_connection_t *conn,
const int ed_changed = ed_id_was_set &&
(!ed_id || !ed25519_pubkey_eq(ed_id, &chan->ed25519_identity));
- tor_assert(!rsa_changed || !rsa_id_was_set);
- tor_assert(!ed_changed || !ed_id_was_set);
+ if (BUG(rsa_changed && rsa_id_was_set))
+ return;
+ if (BUG(ed_changed && ed_id_was_set))
+ return;
if (!rsa_changed && !ed_changed)
return;