From a2bb61f06ba0bfe70a04f3420b17d57e5d61a6b5 Mon Sep 17 00:00:00 2001 From: Jora Troosh Date: Tue, 23 Jul 2024 00:17:14 +0300 Subject: [PATCH] fix: add `-fno-sanitize=undefined` to every compilation --- build.zig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build.zig b/build.zig index e0a23a1..1b18ee0 100644 --- a/build.zig +++ b/build.zig @@ -491,7 +491,7 @@ pub fn build(b: *std.Build) !void { }); socketfuzz_lib.addCSourceFile(.{ .file = AFLplusplus_utl_path.path(b, "socket_fuzzing/socketfuzz.c"), - .flags = &.{ if (ptr_bit_width == 32) "-m32" else "-m64", "-Wall", "-Wextra" }, + .flags = &.{ if (ptr_bit_width == 32) "-m32" else "-m64", "-Wall", "-Wextra", "-fno-sanitize=undefined" }, }); socketfuzz_lib.addIncludePath(AFLplusplus_inc_path); socketfuzz_lib.linkLibC(); @@ -511,7 +511,7 @@ pub fn build(b: *std.Build) !void { }); argvfuzz_lib.addCSourceFile(.{ .file = AFLplusplus_utl_path.path(b, "argv_fuzzing/argvfuzz.c"), - .flags = &.{ if (ptr_bit_width == 32) "-m32" else "-m64", "-Wall", "-Wextra" }, + .flags = &.{ if (ptr_bit_width == 32) "-m32" else "-m64", "-Wall", "-Wextra", "-fno-sanitize=undefined" }, }); argvfuzz_lib.addIncludePath(AFLplusplus_inc_path); argvfuzz_lib.linkLibC(); @@ -575,6 +575,7 @@ const EXE_FLAGS = .{ "-Wno-pointer-sign", "-Wno-pointer-arith", "-Wno-variadic-macros", + "-fno-sanitize=undefined", "-DDOC_PATH=\"\"", "-D_AFL_SPECIAL_PERFORMANCE", }; @@ -590,6 +591,7 @@ const LLVM_EXE_C_FLAGS = .{ "-Wno-unused-result", "-Wno-unused-function", "-Wno-variadic-macros", + "-fno-sanitize=undefined", "-Wno-deprecated-copy-with-dtor", "-DUSE_BINDIR=1", "-DAFL_REAL_LD=\"lld\"", @@ -632,5 +634,6 @@ const UTIL_LIB_FLAGS = .{ "-funroll-loops", "-Wall", "-Wno-pointer-sign", + "-fno-sanitize=undefined", "-D_FORTIFY_SOURCE=2", };