bug(android): safe area inset arithmetic has no bounds check — UI can shift off-screen #66

Closed
opened 2026-05-28 01:52:11 +00:00 by funman300 · 0 comments
Owner

Bug

solitaire_engine/src/safe_area.rs applies safe area insets to layout without clamping. On devices with unusually large insets (foldables, very tall notches) or if the JNI polling returns a bogus value, the inset math could push UI elements off the visible screen area entirely.

Affected file

solitaire_engine/src/safe_area.rs

Fix

Clamp each inset value to a sane maximum before applying it (e.g. 20% of the window dimension):

let max_top = window_height * 0.20;
let safe_top = insets.top.min(max_top);

Also add a warn!() if an inset exceeds the threshold so it is visible during device testing.

## Bug `solitaire_engine/src/safe_area.rs` applies safe area insets to layout without clamping. On devices with unusually large insets (foldables, very tall notches) or if the JNI polling returns a bogus value, the inset math could push UI elements off the visible screen area entirely. ## Affected file `solitaire_engine/src/safe_area.rs` ## Fix Clamp each inset value to a sane maximum before applying it (e.g. 20% of the window dimension): ```rust let max_top = window_height * 0.20; let safe_top = insets.top.min(max_top); ``` Also add a `warn!()` if an inset exceeds the threshold so it is visible during device testing.
funman300 added the bugandroid labels 2026-05-28 01:52:11 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/Ferrous-Solitaire#66