Repository navigation
libobs: Treat a NULL X11 keymap reply as nothing pressed - #231
Merged
Merged
Conversation
xcb_query_keymap_reply() returns NULL with no error when the X connection is closing or broken, and key_pressed() then read the key bits from NULL, crashing the hotkey thread at startup or shutdown (#126). Moves the bit test into obs-nix-x11-keymap.h unchanged and adds test_x11_keymap. null_reply_is_not_pressed crashes with SIGSEGV. Co-Authored-By: Claude Opus 5.5 <[email protected]>
obs_nix_x11_keycode_pressed() returns false for a NULL reply, so the hotkey thread no longer crashes when xcb_query_keymap fails without an error. test_x11_keymap passes. Fixes #126 Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=01b25b4a2501098ca8e0e10e3a29f8aeb089e555 secs=120 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791717528,"gate":"rust/all/fmt","host":"linux-x86_64","key":"ae98e72e0eff40fcf58123d48dd82be068455992034b66efb25494ba1af712cb","lane":"lint","parents":["28eb7c6e3fe5e041e2e53e7ebdf2747b3b88d6be"],"secs":48,"stamp":"b6a7b436ca74a64921f049e9f5c3985c","tree":"01b25b4a2501098ca8e0e10e3a29f8aeb089e555","v":1,"via":"run"} Ci-Attestation: {"at":1791717528,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"ae98e72e0eff40fcf58123d48dd82be068455992034b66efb25494ba1af712cb","lane":"lint","parents":["28eb7c6e3fe5e041e2e53e7ebdf2747b3b88d6be"],"secs":48,"stamp":"c75ab3c63b11976544247f2e5e7c6388","tree":"01b25b4a2501098ca8e0e10e3a29f8aeb089e555","v":1,"via":"run"} Ci-Attestation: {"at":1791717528,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"9f8533de03bcb57be20326af57e0cb18dd23c63e15af7f5c1dd7541e03c21ea1","lane":"rust-test","parents":["28eb7c6e3fe5e041e2e53e7ebdf2747b3b88d6be"],"secs":29,"stamp":"9cf837e33e62c69bc6585fe9ff2095cc","tree":"01b25b4a2501098ca8e0e10e3a29f8aeb089e555","v":1,"via":"run"} Ci-Attestation: {"at":1791717528,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"54958d783f3ae958606e50fedf075ad3eb72e333a9efb13e1ab9c02d23dba666","lane":"tier2-linux","parents":["28eb7c6e3fe5e041e2e53e7ebdf2747b3b88d6be"],"secs":43,"stamp":"4cd9eeb5da8ebda661cfd29157e0155e","tree":"01b25b4a2501098ca8e0e10e3a29f8aeb089e555","v":1,"via":"run"}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #126.
When the X connection is closing or broken,
xcb_query_keymap_reply()returns NULL with no error.key_pressed()only checkederror, so the hotkey thread read the key bits from NULL and crashed, at shutdown and (under valgrind) at startup. The sanitizer workflow hit this in all three of its passes.libobs/obs-nix-x11-keymap.h, which needs only the xcb reply type.test_x11_keymapfailed:null_reply_is_not_pressedhitSegmentation fault(11)(Tier 2 passed 76 of 77).ENABLE_RUST_LIBOBSOFF and 77 of 77 with it ON.Local gate: lint, rust-test and tier2-linux all passed.