Skip to content

Commit

Permalink
Fix folly::dynamic crash when attaching a debugger to Hermes
Browse files Browse the repository at this point in the history
Summary:
folly_futures was compiled with and exported -DFOLLY_MOBILE=1, while
folly_json did not. This flag disables fancy F14 data structures for
folly::dynamic in favor of a simple std::unordered_map.

This caused inlined/templated code from modules depending on
folly_futures to disagree with the implementations in folly_json,
leading to a crash.

The only such libraries were libhermes-inspector and (transitively)
libhermes-executor-debug, and these only use folly::dynamic for CDP
serialization, which is why the problem was not more apparent.

Changelog: [Internal] Fix crash when attaching a Hermes debugger

Reviewed By: mhorowitz

Differential Revision: D21193307

fbshipit-source-id: 2b795bb6f4f7f991e2adaacec62d62616117322b
  • Loading branch information
willholen authored and facebook-github-bot committed Apr 23, 2020
1 parent 2c473e1 commit d06ee3d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions ReactAndroid/src/main/jni/third-party/folly/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ FOLLY_FLAGS := \
-DFOLLY_NO_CONFIG=1 \
-DFOLLY_HAVE_CLOCK_GETTIME=1 \
-DFOLLY_HAVE_MEMRCHR=1 \
-DFOLLY_USE_LIBCPP=1
-DFOLLY_USE_LIBCPP=1 \
-DFOLLY_MOBILE=1

# If APP_PLATFORM in Application.mk targets android-23 above, please comment this line.
# NDK uses GNU style stderror_r() after API 23.
Expand Down Expand Up @@ -87,9 +88,6 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)

LOCAL_CFLAGS += -fexceptions -fno-omit-frame-pointer -frtti -Wno-sign-compare

FOLLY_FLAGS += \
-DFOLLY_MOBILE=1

LOCAL_CFLAGS += $(FOLLY_FLAGS)

LOCAL_EXPORT_CPPFLAGS := $(FOLLY_FLAGS)
Expand Down

0 comments on commit d06ee3d

Please sign in to comment.