diff --git a/ReactCommon/cxxreact/JSBigString.cpp b/ReactCommon/cxxreact/JSBigString.cpp index 834a7ca6900f8d..77e22800fd8e6a 100644 --- a/ReactCommon/cxxreact/JSBigString.cpp +++ b/ReactCommon/cxxreact/JSBigString.cpp @@ -126,6 +126,13 @@ const char *JSBigFileString::c_str() const { } #endif // WITH_FBREMAP } + static const size_t kMinPageSize = 4096; + CHECK(!(reinterpret_cast(m_data) & (kMinPageSize - 1))) + << "mmap address misaligned, likely corrupted" + << " m_data: " << (const void *)m_data; + CHECK(m_pageOff <= m_size) + << "offset impossibly large, likely corrupted" + << " m_pageOff: " << m_pageOff << " m_size: " << m_size; return m_data + m_pageOff; }