tlsnotary / tlsn

Rust implementation of the TLSNotary protocol
https://tlsnotary.org
277 stars 70 forks source link

GHASH test_masked_xtable test failing #81

Closed sinui0 closed 2 years ago

sinui0 commented 2 years ago

I randomly encountered the below failed test having not modified anything. This is one of the drawbacks of using rng in tests, but simultaneously some sort of benefit because now we've essentially fuzzed this test :laughing: I haven't investigated yet.

thread 'ghash::utils::tests::test_masked_xtable' panicked at 'attempt to add with overflow', tls-2pc-core/src/ghash/utils.rs:505:24
stack backtrace:
   0: rust_begin_unwind
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/panicking.rs:142:14
   2: core::panicking::panic
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/panicking.rs:48:5
   3: tls_2pc_core::ghash::utils::tests::test_masked_xtable
             at ./src/ghash/utils.rs:505:24
   4: tls_2pc_core::ghash::utils::tests::test_masked_xtable::{{closure}}
             at ./src/ghash/utils.rs:495:5
   5: core::ops::function::FnOnce::call_once
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/ops/function.rs:248:5
   6: core::ops::function::FnOnce::call_once
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
test ghash::utils::tests::test_masked_xtable ... FAILED
th4s commented 2 years ago

If any of these expressions is 255, we get an overflow because of the +1

bad_bytes[5] = (bad_bytes[5] + 1) / 255;