Skip to content

Fix uninitialized SimMap state causing crashes with simd - #43

Open
GuillaumeDelorme wants to merge 1 commit into
Spacefreak18:masterfrom
GuillaumeDelorme:fix-uninitialized-simmap-state
Open

GuillaumeDelorme wants to merge 1 commit into
Spacefreak18:masterfrom
GuillaumeDelorme:fix-uninitialized-simmap-state

Conversation

@GuillaumeDelorme

Copy link
Copy Markdown
Contributor

SimMap was allocated with malloc but only fd and addr were initialized. The uninitialized hasSimApiDat flag could cause simapi_init() to skip shared-memory setup. With simd running, the subsequent simapi_datamap() call then attempted to copy from a null address, causing SIGSEGV.

Initialize the entire structure, handle allocation failure, and check initialization errors before reading telemetry. The public API remains unchanged.

I reproduced the crash with LMU using my Rust binding (https://github.com/GuillaumeDelorme/simapi-rs). It don't crash anymore if i rebuild simd with this fix.

This branch has not been deployed

No deployments
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.

1 participant