From 7135eb3f82dad3b69eebe66149b948956698d51f Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sat, 2 Mar 2024 23:13:18 -0600 Subject: [PATCH] Re-enable ASAN for the fuzzer Fixes #131 Also touch the scanner to poke the fuzzer CI --- justfile | 3 +-- src/scanner.c | 8 +++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/justfile b/justfile index 92ff982..3d0aa64 100644 --- a/justfile +++ b/justfile @@ -18,8 +18,7 @@ just_sha := "a2ff42e6c37ba5c429d444f3a18d3633e59f9a34" # 1.24.0 include_args := "-Isrc/ -I" + ts_path + "/lib/include -Inode_modules/nan" general_cflags := "-Wall -Werror --pedantic -Wno-format-pedantic" -# FIXME: there are errors running with ASAN, we ideally want `,address` here -fuzzer_flags := env("FUZZER_FLAGS", "-fsanitize=fuzzer,undefined") +fuzzer_flags := env("FUZZER_FLAGS", "-fsanitize=fuzzer,address,undefined") fuzz_time := env("FUZZ_TOTAL_TIME", "1200") # Source files needed to build a parser diff --git a/src/scanner.c b/src/scanner.c index 848e601..4328dea 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -16,6 +16,12 @@ #define __FILE_NAME__ __FILE__ #endif +#ifdef __GNUC__ +#define unused_attr __attribute__((unused)) +#else +#define unused_attr +#endif + #ifdef DEBUG_PRINT #define dbg_print(...) \ do { \ @@ -56,7 +62,7 @@ enum TokenType { TOKEN_TYPE_END, }; -void assert_valid_token(const TSSymbol sym) { +unused_attr static inline void assert_valid_token(const TSSymbol sym) { assertf(sym >= INDENT && sym < TOKEN_TYPE_END, "invalid symbol %d", sym); }