Open wcampbell0x2a opened 2 years ago
Annnd it's on our end, tested: https://github.com/sharksforarms/deku/pull/246.
test impls::bool::tests::test_bool::case_1 ... error: Undefined Behavior: pointer arithmetic failed: 0x4d39df is not a valid pointer
--> /home/wcampbell/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mut_ptr.rs:469:18
|
469 | unsafe { intrinsics::offset(self, count) as *mut T }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer arithmetic failed: 0x4d39df is not a valid pointer
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: inside `std::ptr::mut_ptr::<impl *mut u8>::offset` at /home/wcampbell/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mut_ptr.rs:469:18
= note: inside closure at /home/wcampbell/.cargo/registry/src/github.com-1ecc6299db9ec823/wyz-0.5.0/src/comu.rs:259:24
= note: inside `<*mut u8 as tap::pipe::Pipe>::pipe::<*mut u8, [closure@wyz::comu::Address<bitvec::ptr::Const, u8>::offset::{closure#0}]>` at /home/wcampbell/.cargo/registry/src/github.com-1ecc6299db9ec823/tap-1.0.1/src/pipe.rs:78:3
= note: inside `wyz::comu::Address::<bitvec::ptr::Const, u8>::with_ptr::<u8, [closure@wyz::comu::Address<bitvec::ptr::Const, u8>::offset::{closure#0}]>` at /home/wcampbell/.cargo/registry/src/github.com-1ecc6299db9ec823/wyz-0.5.0/src/comu.rs:329:3
= note: inside `wyz::comu::Address::<bitvec::ptr::Const, u8>::offset` at /home/wcampbell/.cargo/registry/src/github.com-1ecc6299db9ec823/wyz-0.5.0/src/comu.rs:259:4
= note: inside `bitvec::ptr::BitPtr::<bitvec::ptr::Const, u8, bitvec::order::Msb0>::offset` at /home/wcampbell/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-1.0.0/src/ptr/single.rs:527:23
= note: inside `bitvec::ptr::BitPtr::<bitvec::ptr::Const, u8, bitvec::order::Msb0>::add` at /home/wcampbell/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-1.0.0/src/ptr/single.rs:684:3
= note: inside `bitvec::slice::BitSlice::<u8, bitvec::order::Msb0>::split_at_unchecked` at /home/wcampbell/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-1.0.0/src/slice.rs:857:15
= note: inside `bitvec::slice::api::<impl bitvec::slice::BitSlice<u8, bitvec::order::Msb0>>::split_at` at /home/wcampbell/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-1.0.0/src/slice/api.rs:1154:12
note: inside `impls::primitive::<impl DekuRead<(ctx::Endian, ctx::Size)> for u8>::read` at src/impls/primitive.rs:31:41
--> src/impls/primitive.rs:31:41
|
31 | let (bit_slice, rest) = input.split_at(bit_size);
| ^^^^^^^^^^^^^^^^^^^^^^^^
...
211 | ImplDekuTraits!(u8);
| ------------------- in this macro invocation
note: inside `impls::primitive::<impl DekuRead<ctx::Endian> for u8>::read` at src/impls/primitive.rs:106:17
--> src/impls/primitive.rs:106:17
|
106 | <$typ>::read(input, (endian, max_type_bits))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
211 | ImplDekuTraits!(u8);
| ------------------- in this macro invocation
note: inside `impls::primitive::<impl DekuRead for u8>::read` at src/impls/primitive.rs:127:17
--> src/impls/primitive.rs:127:17
|
127 | <$typ>::read(input, Endian::default())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
211 | ImplDekuTraits!(u8);
| ------------------- in this macro invocation
note: inside `impls::bool::<impl DekuRead for bool>::read` at src/impls/bool.rs:18:27
--> src/impls/bool.rs:18:27
|
18 | let (rest, val) = u8::read(input, inner_ctx)?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `impls::bool::tests::test_bool` at src/impls/bool.rs:61:32
--> src/impls/bool.rs:61:32
|
61 | let (rest, res_read) = bool::read(bit_slice, ()).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `impls::bool::tests::test_bool::case_1` at src/impls/bool.rs:52:5
--> src/impls/bool.rs:52:5
|
52 | / #[rstest(input, expected,
53 | | case(&hex!("00"), false),
54 | | case(&hex!("01"), true),
55 | |
56 | | #[should_panic(expected = "Parse(\"cannot parse bool value: 2\")")]
57 | | case(&hex!("02"), false),
58 | | )]
| |______^
note: inside closure at src/impls/bool.rs:52:5
--> src/impls/bool.rs:52:5
|
52 | / #[rstest(input, expected,
53 | | case(&hex!("00"), false),
54 | | case(&hex!("01"), true),
55 | |
56 | | #[should_panic(expected = "Parse(\"cannot parse bool value: 2\")")]
57 | | case(&hex!("02"), false),
58 | | )]
| |______^
= note: this error originates in the macro `ImplDekuTraits` (in Nightly builds, run with -Z macro-backtrace for more info)
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
error: aborting due to previous error
error: test failed, to rerun pass '--lib'
This message has been changed on nightly:
test impls::bool::tests::test_bool::case_1 ... error: unsupported operation: integer-to-pointer casts and `ptr::from_exposed_addr` are not supported with `-Zmiri-strict-provenance`
--> /home/wcampbell/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-0.22.3/src/ptr/span.rs:343:32
|
343 | ptr: NonNull::new_unchecked((ptr_data | ptr_head) as *mut ()),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ integer-to-pointer casts and `ptr::from_exposed_addr` are not supported with `-Zmiri-strict-provenance`
|
= help: use Strict Provenance APIs (https://doc.rust-lang.org/nightly/std/ptr/index.html#strict-provenance, https://crates.io/crates/sptr) instead
= note: backtrace:
= note: inside `bitvec::ptr::span::BitSpan::<bitvec::ptr::Const, bitvec::order::Msb0, u8>::new_unchecked` at /home/wcampbell/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-0.22.3/src/ptr/span.rs:343:32
= note: inside `bitvec::prelude::BitPtr::<bitvec::ptr::Const, bitvec::order::Msb0, u8>::span_unchecked` at /home/wcampbell/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-0.22.3/src/ptr/single.rs:267:3
= note: inside `bitvec::prelude::BitSlice::<bitvec::order::Msb0, u8>::from_slice_unchecked` at /home/wcampbell/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-0.22.3/src/slice.rs:703:3
= note: inside `bitvec::prelude::BitSlice::<bitvec::order::Msb0, u8>::from_slice` at /home/wcampbell/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-0.22.3/src/slice.rs:615:15
= note: inside `<[u8] as bitvec::view::BitView>::view_bits::<bitvec::order::Msb0>` at /home/wcampbell/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-0.22.3/src/view.rs:124:3
note: inside `impls::bool::tests::test_bool` at src/impls/bool.rs:60:25
--> src/impls/bool.rs:60:25
|
60 | let bit_slice = input.view_bits::<Msb0>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `impls::bool::tests::test_bool::case_1` at src/impls/bool.rs:52:5
--> src/impls/bool.rs:52:5
|
52 | / #[rstest(input, expected,
53 | | case(&hex!("00"), false),
54 | | case(&hex!("01"), true),
55 | |
56 | | #[should_panic(expected = "Parse(\"cannot parse bool value: 2\")")]
57 | | case(&hex!("02"), false),
58 | | )]
| |______^
note: inside closure at src/impls/bool.rs:52:5
--> src/impls/bool.rs:52:5
|
52 | / #[rstest(input, expected,
53 | | case(&hex!("00"), false),
54 | | case(&hex!("01"), true),
55 | |
56 | | #[should_panic(expected = "Parse(\"cannot parse bool value: 2\")")]
57 | | case(&hex!("02"), false),
58 | | )]
| |______^
= note: this error originates in the attribute macro `rstest` (in Nightly builds, run with -Z macro-backtrace for more info)
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
error: aborting due to previous error
error: test failed, to rerun pass '--lib'
looks like more of a bitvec problem.
from the update to v1.0.1 branch:
test impls::bool::tests::test_bool::case_1 ... error: unsupported operation: integer-to-pointer casts and `ptr::from_exposed_addr` are not supported with `-Zmiri-strict-provenance`
--> /home/wcampbell/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-1.0.1/src/ptr/span.rs:254:5
|
254 | (self.ptr.as_ptr() as usize & Self::PTR_ADDR_MASK) as *mut T,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ integer-to-pointer casts and `ptr::from_exposed_addr` are not supported with `-Zmiri-strict-provenance`
|
= help: use Strict Provenance APIs (https://doc.rust-lang.org/nightly/std/ptr/index.html#strict-provenance, https://crates.io/crates/sptr) instead
= note: backtrace:
= note: inside `bitvec::ptr::span::BitSpan::<bitvec::ptr::Const, u8, bitvec::order::Msb0>::address` at /home/wcampbell/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-1.0.1/src/ptr/span.rs:254:5
= note: inside `bitvec::ptr::span::BitSpan::<bitvec::ptr::Const, u8, bitvec::order::Msb0>::to_bitptr` at /home/wcampbell/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-1.0.1/src/ptr/span.rs:533:34
= note: inside `bitvec::slice::BitSlice::<u8, bitvec::order::Msb0>::as_bitptr` at /home/wcampbell/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-1.0.1/src/slice.rs:450:3
= note: inside `bitvec::slice::BitSlice::<u8, bitvec::order::Msb0>::split_at_unchecked` at /home/wcampbell/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-1.0.1/src/slice.rs:879:14
= note: inside `bitvec::slice::api::<impl bitvec::slice::BitSlice<u8, bitvec::order::Msb0>>::split_at` at /home/wcampbell/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-1.0.1/src/slice/api.rs:1190:12
note: inside `impls::primitive::<impl DekuRead<(ctx::Endian, ctx::Size)> for u8>::read` at src/impls/primitive.rs:31:41
--> src/impls/primitive.rs:31:41
|
31 | let (bit_slice, rest) = input.split_at(bit_size);
| ^^^^^^^^^^^^^^^^^^^^^^^^
...
211 | ImplDekuTraits!(u8);
| ------------------- in this macro invocation
note: inside `impls::primitive::<impl DekuRead<ctx::Endian> for u8>::read` at src/impls/primitive.rs:106:17
--> src/impls/primitive.rs:106:17
|
106 | <$typ>::read(input, (endian, max_type_bits))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
211 | ImplDekuTraits!(u8);
| ------------------- in this macro invocation
note: inside `impls::primitive::<impl DekuRead for u8>::read` at src/impls/primitive.rs:127:17
--> src/impls/primitive.rs:127:17
|
127 | <$typ>::read(input, Endian::default())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
211 | ImplDekuTraits!(u8);
| ------------------- in this macro invocation
note: inside `impls::bool::<impl DekuRead for bool>::read` at src/impls/bool.rs:18:27
--> src/impls/bool.rs:18:27
|
18 | let (rest, val) = u8::read(input, inner_ctx)?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `impls::bool::tests::test_bool` at src/impls/bool.rs:61:32
--> src/impls/bool.rs:61:32
|
61 | let (rest, res_read) = bool::read(bit_slice, ()).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `impls::bool::tests::test_bool::case_1` at src/impls/bool.rs:52:5
--> src/impls/bool.rs:52:5
|
52 | / #[rstest(input, expected,
53 | | case(&hex!("00"), false),
54 | | case(&hex!("01"), true),
55 | |
56 | | #[should_panic(expected = "Parse(\"cannot parse bool value: 2\")")]
57 | | case(&hex!("02"), false),
58 | | )]
| |______^
note: inside closure at src/impls/bool.rs:52:5
--> src/impls/bool.rs:52:5
|
52 | / #[rstest(input, expected,
53 | | case(&hex!("00"), false),
54 | | case(&hex!("01"), true),
55 | |
56 | | #[should_panic(expected = "Parse(\"cannot parse bool value: 2\")")]
57 | | case(&hex!("02"), false),
58 | | )]
| |______^
= note: this error originates in the macro `ImplDekuTraits` (in Nightly builds, run with -Z macro-backtrace for more info)
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
error: aborting due to previous error
error: test failed, to rerun pass '--lib`
This might be fixed, but not published. https://github.com/bitvecto-rs/bitvec/commit/4e7f51124591dac0bfe6ab4b7c4d788784009cfb
Thanks for staying on top of this @wcampbell0x2a! This would be pending https://github.com/sharksforarms/deku/pull/246 most likely
Well, the fix for the above problem isn't in bitvec v1.0.1
, and that fix is on github but not on crates.io for v1.1.0
.
Updating to taking bitvec from the git repo give me a new error!
Fixed with the MR https://github.com/ferrilab/bitvec/pull/266, who knows when this will be merged.
Found this while adding miri to testing my adsb-deku crate. Which looked to be a deku issue.
I ran the same command within
bitvec
and none of its tests resulted in the undefined behavior. But that isv1.0.0
, which deku still doesn't use :(