Open YangKeao opened 1 year ago
The embarrasing part is that this problem cannot be reproduced through test, so the current test cannot cover this situation...
Right... Though there is a assert_unsafe_precondition
check in from_raw_parts
, we almost always use the prebuilt libstd in release mode which eliminates the checks.
If we enable -Z build-std
, we will reproduce the panic.
I have no idea about the CI failures due to linking errors...
Hey, as a data point, I just hit this and building with release did fix it.
I hit this specifically because I'm a M1 user. So first adding this crate and running it crashed. I read https://github.com/tikv/pprof-rs/issues/187 and enabled the frame pointer feature flag, nightly and added -Z build-std.
Then I hit this.
Signed-off-by: YangKeao yangkeao@chunibyo.icu
Validate whether the address is null before trying to construct the slice. Because in debug build, the
from_raw_parts
will check whether the addr is null and aligned, if not, it will panic.The embarrasing part is that this problem cannot be reproduced through test, so the current test cannot cover this situation...