Skip to content

GameActivity: no slice from a null text pointer before the first text state - #254

Open
taublast wants to merge 1 commit into
rust-mobile:mainfrom
taublast:pr-null-text
Open

taublast wants to merge 1 commit into
rust-mobile:mainfrom
taublast:pr-null-text

Conversation

@taublast

@taublast taublast commented Oct 6, 2026

Copy link
Copy Markdown

GameTextInput's state has a null text_UTF8 until a state is first set (by the app or the IME). AndroidApp::text_input_state() called before that passed the null pointer to slice::from_raw_parts, which is undefined behavior even for length 0 (with debug assertions: "unsafe precondition(s) violated: slice::from_raw_parts requires the pointer to be aligned and non-null"). An empty slice is used instead.

AI assistance: the code and this text were written with Claude (Anthropic); the commits carry a Co-Authored-By line.

… state

GameTextInput's state has a null text_UTF8 until a state is first set (by the app or
the IME). AndroidApp::text_input_state() called before that passed the null pointer
to slice::from_raw_parts, which is undefined behavior even for length 0 (a panic with
debug assertions: 'unsafe precondition(s) violated: slice::from_raw_parts requires the
pointer to be aligned and non-null'). An empty slice is used instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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