Skip to content

Harden pre-mutex setter pattern: capture mutex pointer once (TOCTOU) #106

Description

@GenericJam

All four pre-nif_load-safe setters (mob_set_launch_notification + mob_set_opened_document, Android zig + iOS ObjC) read the mutex global twice: once to decide whether to lock, once to unlock. If a warm event lands exactly while nif_load is creating the mutex, a setter could skip the lock but then unlock a mutex it never locked (UB). Vanishingly narrow window; one-line fix per function — capture the pointer into a local and use it for both decisions. Found during PR #77 review (see review comment there for file/line refs at that head: zig ~2255/2258, ObjC ~2392/2396).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions