Merge pull request #7268 from ethereum/fix-7264

jsoncpp: force explicit casts for integer to floating point conversion
This commit is contained in:
Bhargava Shastry 2019-08-15 18:10:15 +02:00 committed by GitHub
commit c89eb84372
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,7 +19,14 @@ if(EMSCRIPTEN)
# at the moment.
set(JSONCPP_CXX_FLAGS -std=c++17)
else()
set(JSONCPP_CXX_FLAGS ${CMAKE_CXX_FLAGS})
# jsoncpp uses implicit casts for comparing integer and
# floating point numbers. This causes clang-10 (used by ossfuzz builder)
# to error on the implicit conversions. Here, we request jsoncpp
# to unconditionally use static casts for these conversions by defining the
# JSON_USE_INT64_DOUBLE_CONVERSION preprocessor macro. Doing so,
# not only gets rid of the implicit conversion error that clang-10 produces
# but also forces safer behavior in general.
set(JSONCPP_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DJSON_USE_INT64_DOUBLE_CONVERSION")
endif()
set(byproducts "")