Skip to content

Thread 'main' panicked at 'called Result::unwrap() on an Err value: FromBytesWithNulError { kind: InteriorNul(29) } #2566

@XVilka

Description

@XVilka

Input C/C++ Header

Sorry, but I wasn't able to reduce headers for some reason - error disappears. I am attaching the full project and an archive with the Rizin headers.

The system is macOS ARM64 13.4

bindgen-crash-reproducer.zip

rizin-headers.zip

error_report.log.zip

The headers are of the Rizin project: https://github.com/rizinorg/rizin

Bindgen Invocation

See build.rs in the attached archive

Actual Results

  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: FromBytesWithNulError { kind: InteriorNul(29) }', /Users/anton.kochkov/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.66.1/codegen/mod.rs:717:71
  stack backtrace:
     0:        0x1047a73cc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf56058dac04a8100
     1:        0x1047d6cc0 - core::fmt::write::h887ee594c50d2f6b
     2:        0x1047b454c - std::io::Write::write_fmt::h8e068fbe7ba944b7
     3:        0x1047a71dc - std::sys_common::backtrace::print::hefee1a8be582057a
     4:        0x1047b1b78 - std::panicking::default_hook::{{closure}}::h7ba479390a999ae5
     5:        0x1047b1840 - std::panicking::default_hook::hc4ff20421fd3aa8b
     6:        0x1047b2188 - std::panicking::rust_panic_with_hook::h97e5266e8ce2f24f
     7:        0x1047a76b8 - std::panicking::begin_panic_handler::{{closure}}::h5c38d4c71a65b53e
     8:        0x1047a74c4 - std::sys_common::backtrace::__rust_end_short_backtrace::h9c79ccffe3575672
     9:        0x1047b1da4 - _rust_begin_unwind
    10:        0x1047f1a10 - core::panicking::panic_fmt::h8d86c61b68da2636
    11:        0x1047f1978 - core::result::unwrap_failed::h2eeab09a9c5ad8bf
    12:        0x1042d8030 - core::result::Result<T,E>::unwrap::h1b98d57917a790d1
                                 at /private/tmp/rust-20230613-7622-103lepv/rustc-1.70.0-src/library/core/src/result.rs:1089:23
    13:        0x1042dd688 - <bindgen::ir::var::Var as bindgen::codegen::CodeGenerator>::codegen::hfa34c4704686e659
                                 at /Users/anton.kochkov/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.66.1/codegen/mod.rs:717:32
    14:        0x1043dbb70 - <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen::h6555b708a86e7e40
                                 at /Users/anton.kochkov/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.66.1/codegen/mod.rs:540:17
    15:        0x1043dc458 - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::{{closure}}::h0ab018d8d97f5085
                                 at /Users/anton.kochkov/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.66.1/codegen/mod.rs:566:21
    16:        0x1043dbd68 - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::hb4681d111f39a976
                                 at /Users/anton.kochkov/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.66.1/codegen/mod.rs:596:13
    17:        0x1043dbb10 - <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen::h6555b708a86e7e40
                                 at /Users/anton.kochkov/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.66.1/codegen/mod.rs:534:17
    18:        0x1043e52a0 - bindgen::codegen::codegen::{{closure}}::h92236ee983b08dc7
                                 at /Users/anton.kochkov/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.66.1/codegen/mod.rs:4719:9
    19:        0x1042bc200 - bindgen::ir::context::BindgenContext::gen::h2137dffcdda25f99
                                 at /Users/anton.kochkov/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.66.1/ir/context.rs:1218:19
    20:        0x1043e4764 - bindgen::codegen::codegen::h98b27d48bd6c34e1
                                 at /Users/anton.kochkov/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.66.1/codegen/mod.rs:4683:5
    21:        0x1042c9940 - bindgen::Bindings::generate::hbd2b5f712cc64035
                                 at /Users/anton.kochkov/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.66.1/lib.rs:896:13
    22:        0x1042c7b84 - bindgen::Builder::generate::hd4e381d53245babd
                                 at /Users/anton.kochkov/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.66.1/lib.rs:338:9
    23:        0x10425afa4 - build_script_build::main::h42d09c1057897f8a
                                 at /Users/anton.kochkov/Misc/bindgen-crash-reproducer/build.rs:51:20
    24:        0x10425b470 - core::ops::function::FnOnce::call_once::hf83113fa8666a300
                                 at /private/tmp/rust-20230613-7622-103lepv/rustc-1.70.0-src/library/core/src/ops/function.rs:250:5
    25:        0x10425a458 - std::sys_common::backtrace::__rust_begin_short_backtrace::hdcfdf19e930f4e76
                                 at /private/tmp/rust-20230613-7622-103lepv/rustc-1.70.0-src/library/std/src/sys_common/backtrace.rs:134:18
    26:        0x10425c018 - std::rt::lang_start::{{closure}}::hf4635be123a6423d
                                 at /private/tmp/rust-20230613-7622-103lepv/rustc-1.70.0-src/library/std/src/rt.rs:166:18
    27:        0x1047b1cc8 - std::panicking::try::hd27950ade386a4c1
    28:        0x1047bcb14 - std::rt::lang_start_internal::h4c832f79c4cb8516
    29:        0x10425bfe4 - std::rt::lang_start::h3cc6ef3008c55f2f
                                 at /private/tmp/rust-20230613-7622-103lepv/rustc-1.70.0-src/library/std/src/rt.rs:165:17
    30:        0x10425b150 - _main

Expected Results

No crash

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions