diff --git a/libluna/include/luna/UBSAN.h b/libluna/include/luna/UBSAN.h index 2e9202f5..dce0c9f1 100644 --- a/libluna/include/luna/UBSAN.h +++ b/libluna/include/luna/UBSAN.h @@ -70,5 +70,11 @@ namespace UBSAN { SourceLocation location; }; + + struct NonnullArgInfo + { + SourceLocation location; + SourceLocation attr_location; + }; } } diff --git a/libluna/src/UBSAN.cpp b/libluna/src/UBSAN.cpp index 4f3c25d2..46bf2059 100644 --- a/libluna/src/UBSAN.cpp +++ b/libluna/src/UBSAN.cpp @@ -118,4 +118,10 @@ extern "C" }; __ubsan_handle_type_mismatch(&info, pointer); } + + void __ubsan_handle_nonnull_arg(NonnullArgInfo* info, intptr_t) + { + dbgln("ubsan: null argument at %s:%d:%d", DISPLAY(info->location)); + ub_panic(); + } }