From c72cf8946598761ab0aaf6b75a82d224a86a76de Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 4 Feb 2024 12:50:02 +0100 Subject: [PATCH] RapidJSON: use iterative parsing instead Use iterative parsing to protect against stack overflows in rare cases --- src/cmake/Options.cmake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cmake/Options.cmake b/src/cmake/Options.cmake index 56779770..a5972304 100644 --- a/src/cmake/Options.cmake +++ b/src/cmake/Options.cmake @@ -25,8 +25,8 @@ macro( apply_project_settings ) set( OPTION_LTCG_MODE "OFF" CACHE STRING "Enables link-time code generation (significantly increases compile times)" ) set_property( CACHE OPTION_LTCG_MODE PROPERTY STRINGS "OFF" - "ON" - "ALL" + "ON" # Only on projects that specified LTCG + "ALL" # All projects, whether or not LTCG was specified ) option( OPTION_CERTAIN "This build is certain; debug statements (such as DevMsg(...)) will NOT be compiled" OFF ) @@ -44,6 +44,12 @@ macro( apply_project_settings ) # SSE3 and higher, and the next level of optimizations in RapidJSON is SSE4.2. "RAPIDJSON_SSE2" + # Use iterative parsing to protect against stack overflows in rare cases; see: + # https://rapidjson.org/md_doc_features.html + # https://github.com/Tencent/rapidjson/issues/1227 + # https://github.com/Tencent/rapidjson/issues/2260 + "RAPIDJSON_PARSE_DEFAULT_FLAGS=kParseIterativeFlag" + # Target is 64bits only. "PLATFORM_64BITS" )