Skip to content

Commit 26251e3

Browse files
authored
[ubsan] Prevent miniz from performing unaligned load / stores (microsoft#7817)
By default, miniz performs unaligned loads/stores in x86/x64 platforms. This is undefined behavior in C, and so we explicitly disable it. Fixes 98 ubsan / alignment errors when building check-all.
1 parent 0bf8434 commit 26251e3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/DxilCompression/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@ add_llvm_library(LLVMDxilCompression
99
ADDITIONAL_HEADER_DIRS
1010
)
1111

12+
# By default, miniz performs unaligned loads/stores in x86/x64 platforms. This
13+
# is undefined behavior in C, and so we explicitly disable it.
14+
target_compile_definitions(LLVMDxilCompression PRIVATE MINIZ_USE_UNALIGNED_LOADS_AND_STORES=0)
15+
1216
add_dependencies(LLVMDxilCompression intrinsics_gen)
1317

0 commit comments

Comments
 (0)