We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 894c948 commit bdb6ff8Copy full SHA for bdb6ff8
1 file changed
mlx/io/CMakeLists.txt
@@ -17,6 +17,11 @@ if(MLX_BUILD_GGUF)
17
PRIVATE $<BUILD_INTERFACE:${gguflib_SOURCE_DIR}>)
18
add_library(gguflib STATIC ${gguflib_SOURCE_DIR}/fp16.c
19
${gguflib_SOURCE_DIR}/gguflib.c)
20
+ # gguflib uses assert() to reject malformed tensor headers (e.g. ndim > 8).
21
+ # Those checks are otherwise compiled out by -DNDEBUG in release builds, which
22
+ # leaves out-of-bounds reads/writes unguarded when loading untrusted GGUF
23
+ # files. Force NDEBUG off for this target so the asserts stay live.
24
+ target_compile_options(gguflib PRIVATE -UNDEBUG)
25
target_link_libraries(mlx PRIVATE $<BUILD_INTERFACE:gguflib>)
26
target_sources(mlx PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/gguf.cpp
27
${CMAKE_CURRENT_SOURCE_DIR}/gguf_quants.cpp)
0 commit comments