Skip to content

Fix race condition in ReadableNativeMap - #36201

Closed
rshest wants to merge 1 commit into
react:mainfrom
rshest:export-D43398416
Closed

rshest wants to merge 1 commit into
react:mainfrom
rshest:export-D43398416

Conversation

@rshest

@rshest rshest commented Feb 17, 2023

Copy link
Copy Markdown
Contributor

Summary:
[Changelog][Internal]

Guard call to the C++ ReadableNAtiveMap.importValues with a lock.

Note that all the occurrences in this class (together with importTypes) already were protected by a lock, except of this one, which with the very high chance caused crashes in T145271136.

My corresponding comment from the task, for justification:

If callstack to be trusted, the crash happens on the C++ side, in ReadableNativeMap::importValues().
It throws ArrayIndexOutOfBoundsException, which, looking at the code, seems to be only possible due to a corrupted data or race conditions.

Now, looking at the Java side of ReadableNativeMap, and the particular call site... it's very dodgy, since all other occurrences of calling to native importTypes/importValues are guarded by locks, but the one crashing isn't.

NOTE: A couple of importKeys() instances appears to suffer from the same problem as well.

Reviewed By: javache

Differential Revision: D43398416

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants