-
-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Description
In this dir of dasl-testing, the test suite runs uv run main.py libipld to run the Python tests on python-libipld specifically. This works with v3.2.0, but after upgrading it fails:
❯ RUST_BACKTRACE=full uv run main.py libipld
thread '<unnamed>' panicked at src/lib.rs:223:43:
contains length
stack backtrace:
0: 0x7fe2dcdca9a2 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hdcfcb6d4c8489523
1: 0x7fe2dcdadd93 - core::fmt::write::h8a494366950f23bb
2: 0x7fe2dcdca37b - std::io::Write::write_fmt::h6556609fca33d0b1
3: 0x7fe2dcdca803 - std::sys::backtrace::BacktraceLock::print::hb2a626a81e06b2dc
4: 0x7fe2dcdc9e40 - std::panicking::rust_panic_with_hook::h33ac55f64bbd807d
5: 0x7fe2dcdf8188 - std::panicking::begin_panic_handler::{{closure}}::h30e7cb89678a57fe
6: 0x7fe2dcdf80e9 - std::sys::backtrace::__rust_end_short_backtrace::hed60f27456c16ced
7: 0x7fe2dcdf876c - __rustc[de2ca18b4c54d5b8]::rust_begin_unwind
8: 0x7fe2dcdacd3f - core::panicking::panic_fmt::h62f63d096dd276af
9: 0x7fe2dcdaf28a - core::option::expect_failed::h091923fb77e757a1
10: 0x7fe2dcda39d7 - libipld::decode_dag_cbor_to_pyobject::h80c79c22d9de8a70
11: 0x7fe2dcda795a - libipld::<impl libipld::decode_dag_cbor::MakeDef>::_PYO3_DEF::trampoline::h1db913fd485e9a26
12: 0x7fe2dd37631e - _PyEval_EvalFrameDefault
13: 0x7fe2dd44e2c9 - PyEval_EvalCode
14: 0x7fe2dd48c88c - <unknown>
15: 0x7fe2dd48985d - <unknown>
16: 0x7fe2dd486f58 - <unknown>
17: 0x7fe2dd486212 - <unknown>
18: 0x7fe2dd485b83 - <unknown>
19: 0x7fe2dd483e51 - Py_RunMain
20: 0x7fe2dd43bbeb - Py_BytesMain
21: 0x7fe2dce27635 - <unknown>
22: 0x7fe2dce276e9 - __libc_start_main
23: 0x55f311930045 - _start
24: 0x0 - <unknown>
The object that causes the failure is bfff, a valid but indefinite length map.
The offending commit is f988512, with the issue being on line 223 of lib.rs. Instead of decode_len propagating an error, expect is used.
Lines 222 to 223 in ff16379
| major::MAP => { | |
| let len = types::Map::len(r)?.expect("contains length"); |
Presumably the same issue occurs with arrays.
I don't know enough about Rust to nicely fix this, sorry. Maybe just bringing back decode_len would work?
I would definitely recommend removing expect usage wherever possible, since these kinds of crashes can't be caught from Python code.
Thanks!
Metadata
Metadata
Assignees
Labels
No labels