In cmakelists.txt, we have:
| # Decide if we need zlib, and if so whether we want the system zlib or the in-tree copy. |
| if(NOT DISABLE_EMBEDDED_PDB ORNOT DISABLE_LOG_PROFILER_GZ) |
| if(INTERNAL_ZLIB) |
| # defines ZLIB_SOURCES |
| include(${CLR_SRC_NATIVE_DIR}/external/zlib.cmake) |
| else() |
| # if we're not on a platform where we use the in-tree zlib, require system zlib |
| include(${CLR_SRC_NATIVE_DIR}/libs/System.IO.Compression.Native/extra_libs.cmake) |
| set(Z_LIBS) |
| append_extra_compression_libs(Z_LIBS) |
| endif() |
| endif() |
And in zlib.cmake, we have:
| if(MSVC) |
| add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4244>) # conversion from 'type1' to 'type2', possible loss of data |
| else(CMAKE_C_COMPILER_IDMATCHES"Clang") |
| add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-Wno-implicit-int-conversion>) |
| endif() |
The end result is that all of the mono native libs - not just the zlib components - are being built with C4244 disabled, which is causing binskim violations in the official build.
The mono sources should re-enable C4244 as error per SDL and binskim requirements.
See also #91245.
In cmakelists.txt, we have:
runtime/src/mono/CMakeLists.txt
Lines 500 to 511 in 4187876
And in zlib.cmake, we have:
runtime/src/native/external/zlib.cmake
Lines 1 to 5 in 4187876
The end result is that all of the mono native libs - not just the zlib components - are being built with C4244 disabled, which is causing binskim violations in the official build.
The mono sources should re-enable C4244 as error per SDL and binskim requirements.
See also #91245.