rust-x-bindings / rust-xcb

Rust bindings and wrapper for XCB.
MIT License
161 stars 63 forks source link

In debug mode, misaligned pointer dereference: address must be a multiple of 0x4. Not fixed in 1.2.2 #246

Closed igor-petruk closed 9 months ago

igor-petruk commented 9 months ago

I still have this in debug mode in 1.2.2

thread 'main' panicked at /home/user/Project/oatbar/target/debug/build/xcb-f20257292b4ae272/out/xproto.rs:5712:13:
misaligned pointer dereference: address must be a multiple of 0x4 but is 0x786acff5de0b
stack backtrace:
   0:      0x40635957505 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2ef1add730096ec1
   1:      0x4063596a23b - core::fmt::write::hdec8c33ea4b5b46a
   2:      0x40635937a83 - std::io::Write::write_fmt::hd5b3f1e01c127faa
   3:      0x40635957294 - std::sys_common::backtrace::print::h02ceb69c167b7a40
   4:      0x4063591cbf7 - std::panicking::default_hook::{{closure}}::hfd6b0db62d2d623f
   5:      0x4063591c853 - std::panicking::default_hook::haf9ecc875266b220
   6:      0x4063591de85 - std::panicking::rust_panic_with_hook::hc41ac33550e21901
   7:      0x40635957c5b - std::panicking::begin_panic_handler::{{closure}}::h591fc46aa8a26b77
   8:      0x4063595776d - std::sys_common::backtrace::__rust_end_short_backtrace::h046afe6a111a91b7
   9:      0x4063591da99 - rust_begin_unwind
  10:      0x4063596f7e8 - core::panicking::panic_nounwind_fmt::h8e44c4b6cdc9aa59
  11:      0x4063596f9e8 - core::panicking::panic_misaligned_pointer_dereference::h026e547df3d4f7d9
  12:      0x406358900d7 - xcb::xproto::Visualtype::visual_id::ha9fce47e5559057d
                               at /home/user/Project/oatbar/target/debug/build/xcb-f20257292b4ae272/out/xproto.rs:5712:13
  13:      0x406352ee375 - oatbar::window::Window::create_and_show::h6b6f4e042ebf4650
                               at /home/user/Project/oatbar/src/window.rs:156:25
  14:      0x4063540cb2f - oatbar::engine::Engine::new::h98c59c473e8bdd5a
                               at /home/user/Project/oatbar/src/engine.rs:63:26
  15:      0x406352d70e0 - oatbar::main::h31d1b4719a26de3e
                               at /home/user/Project/oatbar/src/main.rs:61:22
  16:      0x4063541af42 - core::ops::function::FnOnce::call_once::h6a55ff0d97354a1d
                               at /usr/obj/ports/rust-1.73.0/rustc-1.73.0-src/library/core/src/ops/function.rs:250:5
  17:      0x406352fe5b5 - std::sys_common::backtrace::__rust_begin_short_backtrace::h309c4eda78c766a0
                               at /usr/obj/ports/rust-1.73.0/rustc-1.73.0-src/library/std/src/sys_common/backtrace.rs:154:18
  18:      0x406353fe568 - std::rt::lang_start::{{closure}}::ha406a21199fb05f2
                               at /usr/obj/ports/rust-1.73.0/rustc-1.73.0-src/library/std/src/rt.rs:166:18
  19:      0x4063591cd6e - std::panicking::try::h48bb3f3b38dce93e
  20:      0x4063592cb32 - std::rt::lang_start_internal::he554301f38ecf35d
  21:      0x406353fe53c - std::rt::lang_start::hfae51838d492285d
                               at /usr/obj/ports/rust-1.73.0/rustc-1.73.0-src/library/std/src/rt.rs:165:17
  22:      0x406352d7705 - main
  23:      0x406352d6b32 - <unknown>
thread caused non-unwinding panic. aborting.

OpenBSD-current, but afaik it should not matter.

❯ rustc --version
rustc 1.73.0 (cc66ad468 2023-10-03) (built from a source tarball)
❯ Xorg -version

X.Org X Server 1.21.1.9
X Protocol Version 11, Revision 0
Current Operating System: OpenBSD host 7.4 GENERIC.MP#4 amd64

Current version of pixman: 0.42.2
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
rtbo commented 9 months ago

Good news: I can reproduce your issue on my machine by executing oatbar

rtbo commented 9 months ago

With #247, the issue seems to be gone. Can you give it a try?

igor-petruk commented 9 months ago

Yes, perfect, it all works! Thank you.

igor-petruk commented 9 months ago

Hi, is there a plan for an upcoming release including this change? Thanks!