Skip to content

Fix CTD caused by misaligned pointer - #58

Merged
BrettMayson merged 3 commits into
BrettMayson:mainfrom
Eathox:main
Aug 24, 2026
Merged

BrettMayson merged 3 commits into
BrettMayson:mainfrom
Eathox:main

Conversation

@Eathox

@Eathox Eathox commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Rust added more debug assertions a while back: in 1.70.0 One of these checks is for misaligned pointers when using slices and arma gives us the command arguments misaligned, resulting in a panic only on debug builds.

This PR fixes that by manually traversing the array and using read_unaligned.

Rust has added a debug_assert to help prevent UB
One such check is for pointer alignment which caused a CTD in debug build
@codecov

codecov Bot commented Aug 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.0%. Comparing base (53086c1) to head (3830a3d).

Files with missing lines Patch % Lines
arma-rs/src/call_context/stack.rs 87.5% 1 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
arma-rs/src/call_context/call.rs 74.8% <100.0%> (+23.6%) ⬆️
arma-rs/src/command.rs 72.6% <100.0%> (+5.3%) ⬆️
arma-rs/src/lib.rs 97.6% <ø> (+1.8%) ⬆️
arma-rs/src/call_context/stack.rs 96.8% <87.5%> (+96.8%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Eathox Eathox closed this Aug 17, 2026
@Eathox

Eathox commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

More testing proofed its still broken, will reopen once I know more

Eathox added 2 commits August 19, 2026 15:33
Also turns `RawStackTraceLine` & `RawContextStackTrace` pub but hidden
so that the intergration tests can use them to construct a stack trace
@Eathox

Eathox commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Command parsing was fine, I just missed call context also being affected.
As part of this I also discovered (and fixed) that steamId and remoteExecutedOwner were being read wrong and gave garbage values.

I've added a test that I believe now covers every instance where this could happen.
As part of this I decided to make RawStackTraceLine and RawContextStackTrace pub but hidden so they could be reused in the emulation test.

Also my testing showed that Arma seems to always sends an count of 6 to RawArmaCallContext::from_arma even when not requesting a stack trace so I would have liked to add a stricter if condition like so:

let flags = FeatureFlags::from_bits(unsafe { RVExtensionFeatureFlags });
let call_stack = if count > 5 && flags.context_stack_trace() {

However the emulation test I added is a little awkward as I didn't figure a way for it to request the context like arma does so instead it uses handle_call_context and the bool clear_call_context in handle_call to make sure it stays around. Which sadly means that flag wont be set in time.

@Eathox Eathox reopened this Aug 19, 2026
@Eathox

Eathox commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Nightly/Miri update introduced a bug? parse_exponential just fails now no matter what commit I checkout

@BrettMayson
BrettMayson merged commit 24bdb4b into BrettMayson:main Aug 24, 2026
24 of 28 checks passed
@Eathox Eathox mentioned this pull request Aug 24, 2026
BrettMayson pushed a commit that referenced this pull request Aug 24, 2026
* Fix miri errors

Switched MissAligner to work with a raw memory ptr to pas the
borrow checks. Also fix some dealloc erros

* Attempt to fix emulate::c_interface_full

* Reduce wait time again for `c_interface_full`

Kinda also doing this to rerun the checks since I cant run those on
command and I wanna see if its not a one off kinda thing

* Fix missing `map_or_default` for c_interface_invalid_calls

* Revert 0f04efc attempted fixes and just increase wait time
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 this pull request may close these issues.

2 participants