From 8a12cfd2d176687e4f3c635e62c980a4801571b3 Mon Sep 17 00:00:00 2001 From: Moti Zilberman Date: Tue, 13 Feb 2024 07:14:49 -0800 Subject: [PATCH] Fix UB in SessionState init Summary: Changelog: [Internal] Specifies initial values for `SessionState`'s bool fields to avoid relying on undefined behaviour. Reviewed By: hoxyq Differential Revision: D53704064 fbshipit-source-id: 798365a8eed8acea3aa50083bf325a0288765097 --- .../ReactCommon/jsinspector-modern/SessionState.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-native/ReactCommon/jsinspector-modern/SessionState.h b/packages/react-native/ReactCommon/jsinspector-modern/SessionState.h index ae5ac3a96b9..b4fe7f8df21 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/SessionState.h +++ b/packages/react-native/ReactCommon/jsinspector-modern/SessionState.h @@ -14,8 +14,8 @@ namespace facebook::react::jsinspector_modern { struct SessionState { public: // TODO: Generalise this to arbitrary domains - bool isLogDomainEnabled; - bool isRuntimeDomainEnabled; + bool isLogDomainEnabled{false}; + bool isRuntimeDomainEnabled{false}; // Here, we will eventually allow RuntimeAgents to store their own arbitrary // state (e.g. some sort of K/V storage of folly::dynamic?)