react-native-macos/ReactCommon
Joshua Gross bb5d04366a Differ: fix TinyMap to prevent possible crashes in `find()` and `begin()`, and prevent erased elements from being iterated over
Summary:
The core issue solved in D21389371 was that erased elements of a TinyMap were being iterated over, because TinyMap has somewhat-complicated logic around cleaning out the underlying vector. In some very marginal cases, vectors were not being cleaned and an iterator pointing at erased elements was being returned.

The diff prevents some possible crashes in `begin()` and `find()` while making it much less likely to iterate over erased elements.

We also add a unit test to catch the case fixed in D21389371, in particular.

We also are keeping the code added in D21389371 (for now) since it's a cheap check, and will be a safeguard until we have rigorous testing around TinyMap. To be clear that logic should noop currently, but will prevent crashes in case guarantees around TinyMap change in the future.

Currently there is only one line of code that actually uses the TinyMap iterator, so this should be safe.

Reviewed By: shergin

Differential Revision: D21392762

fbshipit-source-id: 36dc998958c230fad01af93338974f8889cbcf55
2020-05-04 21:28:35 -07:00
..
better Replace fbsource// with // in xplat/js/ files [1] 2020-03-25 21:55:47 -07:00
callinvoker Add CallInvoker::invokeSync 2020-04-03 09:47:42 -07:00
config Replace fbsource// with // in xplat/js/ files [1] 2020-03-25 21:55:47 -07:00
cxxreact Add CallInvoker::invokeSync 2020-04-03 09:47:42 -07:00
fabric Differ: fix TinyMap to prevent possible crashes in `find()` and `begin()`, and prevent erased elements from being iterated over 2020-05-04 21:28:35 -07:00
hermes Flow 0.123.0 in xplat/js 2020-04-21 22:43:24 -07:00
jsengineinstance The life-changing magic of clang-tidying up 2020-02-04 11:09:30 -08:00
jsi Allow use of std::tuple<> with decorators directly 2020-04-24 15:42:47 -07:00
jsiexecutor Remove out of date TODO 2020-04-16 13:43:07 -07:00
jsinspector make RN infra labels public 2020-02-28 12:46:49 -08:00
microprofiler make RN infra labels public 2020-02-28 12:46:49 -08:00
runtimeexecutor Fabric: Fixing `executeSynchronouslyOnSameThread_CAN_DEADLOCK` 2020-05-01 14:56:16 -07:00
turbomodule Don't use #import in C++ Code (#28825) 2020-05-04 16:52:24 -07:00
utils Move RuntimeExecutor to its own BUCK module (#28730) 2020-04-27 11:39:07 -07:00
yoga Fix rounding error using double instead of float 2020-04-27 14:41:52 -07:00
React-Fabric.podspec Fix Cocoapods builds 2020-04-07 19:07:19 -07:00
ReactCommon.podspec Get CallInvokers from the bridge 2020-04-01 11:39:18 -07:00
common.mk More robust hermes-engine lookup logic in makefiles (#26820) 2019-10-14 19:21:43 -07:00