aboutsummaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorMarvin Borner2021-03-06 17:59:36 +0100
committerMarvin Borner2021-03-06 17:59:36 +0100
commite6abffbca51c35f46911097def2a8ae03f450962 (patch)
tree2b0db68e139f0ab98df741fd297053f35f436b74 /libc
parent03e53516ac31639a47584bd7be655cd2f6f44eb9 (diff)
Added more overflow sanitation logging
Diffstat (limited to 'libc')
-rw-r--r--libc/sanitize.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/libc/sanitize.c b/libc/sanitize.c
index 983b10f..8cfec49 100644
--- a/libc/sanitize.c
+++ b/libc/sanitize.c
@@ -97,28 +97,40 @@ void __ubsan_handle_vla_bound_not_positive(void)
panic("UBSAN: vla-bound-not-positive\n");
}
-void __ubsan_handle_add_overflow(void);
-void __ubsan_handle_add_overflow(void)
+void __ubsan_handle_add_overflow(struct overflow *data, void *left, void *right);
+void __ubsan_handle_add_overflow(struct overflow *data, void *left, void *right)
{
- panic("UBSAN: add-overflow\n");
+ UNUSED(left);
+ UNUSED(right);
+ struct source_location *loc = &data->location;
+ panic("%s:%d: UBSAN: add-overflow [type: %s]\n", loc->file, loc->line, data->type->name);
}
-void __ubsan_handle_sub_overflow(void);
-void __ubsan_handle_sub_overflow(void)
+void __ubsan_handle_sub_overflow(struct overflow *data, void *left, void *right);
+void __ubsan_handle_sub_overflow(struct overflow *data, void *left, void *right)
{
- panic("UBSAN: sub-overflow\n");
+ UNUSED(left);
+ UNUSED(right);
+ struct source_location *loc = &data->location;
+ panic("%s:%d: UBSAN: sub-overflow [type: %s]\n", loc->file, loc->line, data->type->name);
}
-void __ubsan_handle_negate_overflow(void);
-void __ubsan_handle_negate_overflow(void)
+void __ubsan_handle_negate_overflow(struct overflow *data, void *left, void *right);
+void __ubsan_handle_negate_overflow(struct overflow *data, void *left, void *right)
{
- panic("UBSAN: negate-overflow\n");
+ UNUSED(left);
+ UNUSED(right);
+ struct source_location *loc = &data->location;
+ panic("%s:%d: UBSAN: negate-overflow [type: %s]\n", loc->file, loc->line, data->type->name);
}
-void __ubsan_handle_mul_overflow(void);
-void __ubsan_handle_mul_overflow(void)
+void __ubsan_handle_mul_overflow(struct overflow *data, void *left, void *right);
+void __ubsan_handle_mul_overflow(struct overflow *data, void *left, void *right)
{
- panic("UBSAN: mul-overflow\n");
+ UNUSED(left);
+ UNUSED(right);
+ struct source_location *loc = &data->location;
+ panic("%s:%d: UBSAN: mul-overflow [type: %s]\n", loc->file, loc->line, data->type->name);
}
void __ubsan_handle_shift_out_of_bounds(void);