Android security tags, read closely by Lightrion

CVE-2023-40140 AI-generated analysis

platform/frameworks/base, core JNI for android.view.InputDevice / KeyCharacterMap (input)

AI-generated: written from the bulletin and the fixing diffs by claude-fable-5-1, then checked against the code by claude-opus-5-5 (7 corrections). Verify against the commit before relying on it.

android_view_InputDevice_create now gives the Java KeyCharacterMap a copy of the native KeyCharacterMap (std::make_shared<KeyCharacterMap>(*map)) instead of the shared_ptr it shares with the native InputDeviceInfo, so Java-side reads no longer hit the same instance that native code can modify.

Root cause

In core/jni/android_view_InputDevice.cpp, android_view_InputDevice_create passed deviceInfo.getKeyCharacterMap() (a std::shared_ptr<KeyCharacterMap>) directly to android_view_KeyCharacterMap_create. As a result, the Java KeyCharacterMap object and the native key mappings shared one instance. The commit message says a read could be attempted while the mappings were being modified.

How the fix works

Completeness

Behavior changes

Per major

Unknowns

Back to October 2023 · Findings