From f7b4117800285b2312289fd4e5e6172e9740d7a0 Mon Sep 17 00:00:00 2001 From: GitHub Workflows Support Date: Fri, 27 Nov 2026 08:39:55 -0800 Subject: [PATCH] Check the inline range before casting style values to int32 (#2075) Summary: Changelog: [Internal] Reviewed By: javache Differential Revision: D134713724 --- .../ReactCommon/yoga/yoga/style/StyleValuePool.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/react-native/ReactCommon/yoga/yoga/style/StyleValuePool.h b/packages/react-native/ReactCommon/yoga/yoga/style/StyleValuePool.h index c5846658ffb6..24fc39430fa5 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/style/StyleValuePool.h +++ b/packages/react-native/ReactCommon/yoga/yoga/style/StyleValuePool.h @@ -179,9 +179,8 @@ class StyleValuePool { static constexpr bool isIntegerPackable(float f) { constexpr uint16_t kMaxInlineAbsValue = (1 << 11) - 1; - auto i = static_cast(f); - return static_cast(i) == f && i >= -kMaxInlineAbsValue && - i <= +kMaxInlineAbsValue; + return f >= -kMaxInlineAbsValue && f <= +kMaxInlineAbsValue && + static_cast(static_cast(f)) == f; } static constexpr uint16_t packInlineInteger(float value) {