commit a959d7cb98ed0e5b6e2fabf36301accd28f0641c Author: rl1987 rl1987@sdf.lonestar.org Date: Tue Mar 5 17:58:31 2019 +0200
Use tor_assertf{_nonfatal} in code --- src/core/or/circuituse.c | 4 +++- src/test/test_bt_cl.c | 2 +- src/test/testing_rsakeys.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/core/or/circuituse.c b/src/core/or/circuituse.c index 2fdf6f7e8..f77decf53 100644 --- a/src/core/or/circuituse.c +++ b/src/core/or/circuituse.c @@ -3117,7 +3117,9 @@ circuit_sent_valid_data(origin_circuit_t *circ, uint16_t relay_body_len) { if (!circ) return;
- tor_assert_nonfatal(relay_body_len <= RELAY_PAYLOAD_SIZE); + tor_assertf_nonfatal(relay_body_len <= RELAY_PAYLOAD_SIZE, + "Wrong relay_body_len: %d (should be at most %d)", + relay_body_len, RELAY_PAYLOAD_SIZE);
circ->n_delivered_written_circ_bw = tor_add_u32_nowrap(circ->n_delivered_written_circ_bw, relay_body_len); diff --git a/src/test/test_bt_cl.c b/src/test/test_bt_cl.c index 08b08ba42..b29c2c6cb 100644 --- a/src/test/test_bt_cl.c +++ b/src/test/test_bt_cl.c @@ -46,7 +46,7 @@ crash(int x) *(volatile int *)0 = 0; #endif /* defined(__clang_analyzer__) || defined(__COVERITY__) */ } else if (crashtype == 1) { - tor_assert(1 == 0); + tor_assertf(1 == 0, "%d != %d", 1, 0); } else if (crashtype == -1) { ; } diff --git a/src/test/testing_rsakeys.c b/src/test/testing_rsakeys.c index 0f22d4e01..8ba6bf9fe 100644 --- a/src/test/testing_rsakeys.c +++ b/src/test/testing_rsakeys.c @@ -448,7 +448,8 @@ static int next_key_idx_2048; static crypto_pk_t * pk_generate_internal(int bits) { - tor_assert(bits == 2048 || bits == 1024); + tor_assertf(bits == 2048 || bits == 1024, + "Wrong key size: %d", bits);
#ifdef USE_PREGENERATED_RSA_KEYS int *idxp;
tor-commits@lists.torproject.org