Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic: unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null #269

Open
igor-petruk opened this issue Jul 7, 2024 · 0 comments · May be fixed by #277

Comments

@igor-petruk
Copy link

igor-petruk commented Jul 7, 2024

I haven't changed the code, but I might have updated something. Suddenly:

thread 'main' panicked at library/core/src/panicking.rs:220:5:
unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_nounwind_fmt
   2: core::panicking::panic_nounwind
   3: core::intrinsics::copy_nonoverlapping::precondition_check
             at /usr/obj/ports/rust-1.79.0/rustc-1.79.0-src/library/core/src/ub_checks.rs:66:21
   4: core::intrinsics::copy_nonoverlapping
             at /usr/obj/ports/rust-1.79.0/rustc-1.79.0-src/library/core/src/ub_checks.rs:73:17
   5: xcb::base::value_from_ptr
             at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/xcb-1.4.0/src/base.rs:2073:5
   6: xcb::xproto::Visualtype::visual_id
             at ./target/debug/build/xcb-4540465e89c09db9/out/xproto.rs:5712:13
   7: oatbar::window::Window::create_and_show
             at ./src/window.rs:195:25
   8: oatbar::engine::Engine::new
             at ./src/engine.rs:74:26
   9: oatbar::main
             at ./src/main.rs:77:22
  10: core::ops::function::FnOnce::call_once
             at /usr/obj/ports/rust-1.79.0/rustc-1.79.0-src/library/core/src/ops/function.rs:250:5

The crash is here: https://github.com/igor-petruk/oatbar/blob/baf16278217012d9bec6c54e201d47379a263458/src/window.rs#L195

OpenBSD 7.5-snapshot, cargo run only, no problem in --release

rustc -V
rustc 1.79.0 (129f3b996 2024-06-10) (built from a source tarball)
@RealKC RealKC linked a pull request Dec 1, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant