[tor-commits] [tor] 01/08: connection_or_set_identity_digest(): Make errors nonfatal.

gitolite role git at cupani.torproject.org
Wed Jan 11 14:04:45 UTC 2023


This is an automated email from the git hooks/post-receive script.

dgoulet pushed a commit to branch main
in repository tor.

commit 536b5c8059bc3356edb8687c423c5966a2729b6d
Author: Nick Mathewson <nickm at torproject.org>
AuthorDate: Tue Mar 1 11:22:34 2022 -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.
---
 src/core/or/connection_or.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/core/or/connection_or.c b/src/core/or/connection_or.c
index e3e81ed9cb..a6f73d328a 100644
--- 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;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tor-commits mailing list