summaryrefslogtreecommitdiff
path: root/userland/libc/ubsan.c
blob: 9ac9879e27fa33d65a40bef4e33a6f33ead9a858 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <stdio.h>
#include <ubsan.h>

void ubsan_log(const char *cause, struct source_location source) {
  printf("UBSAN\n");
  printf("%s: %s : %d\n", cause, source.file_name, source.line);
  for (;;)
    ;
}

void __ubsan_handle_shift_out_of_bounds(struct ShiftOutOfBoundsData *data,
                                        unsigned long lhs, unsigned long rhs) {
  (void)lhs;
  (void)rhs;
  ubsan_log("handle_shift_out_of_bounds", data->location);
}

void __ubsan_handle_add_overflow(struct OverflowData *data, unsigned long lhs,
                                 unsigned long rhs) {
  (void)lhs;
  (void)rhs;
  ubsan_log("handle_add_overflow", data->location);
}

void __ubsan_handle_sub_overflow(struct OverflowData *data, unsigned long lhs,
                                 unsigned long rhs) {
  (void)lhs;
  (void)rhs;
  ubsan_log("handle_sub_overflow", data->location);
}

void __ubsan_handle_negate_overflow(struct OverflowData *data, unsigned long lhs,
                                 unsigned long rhs) {
  (void)lhs;
  (void)rhs;
  ubsan_log("handle_negate_overflow", data->location);
}

void __ubsan_handle_mul_overflow(struct OverflowData *data, unsigned long lhs,
                                 unsigned long rhs) {
  (void)lhs;
  (void)rhs;
  ubsan_log("handle_mul_overflow", data->location);
}

void __ubsan_handle_out_of_bounds(struct OutOfBoundsData *data, void *index) {
  (void)index;
  ubsan_log("handle_out_of_bounds", data->location);
}