Created
October 17, 2017 22:56
-
-
Save hackcasual/7de2f357714505061506df01923f99cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdint> | |
#include <stdio.h> | |
#include <emscripten.h> | |
using namespace std; | |
struct source_location { | |
const char *file_name; | |
union { | |
unsigned long reported; | |
struct { | |
uint32_t line; | |
uint32_t column; | |
}; | |
}; | |
}; | |
struct type_descriptor { | |
uint16_t type_kind; | |
uint16_t type_info; | |
char type_name[1]; | |
}; | |
struct overflow_data { | |
struct source_location location; | |
struct type_descriptor *type; | |
}; | |
extern "C" { | |
void EMSCRIPTEN_KEEPALIVE __ubsan_handle_add_overflow(struct overflow_data *data, | |
unsigned long lhs, | |
unsigned long rhs) | |
{ | |
printf("Overflow happened %lu + %lu @%s\n", lhs, rhs, data->location.file_name); | |
} | |
} | |
int main(int argc, char **argv) { | |
int k = 0x7fffffff; | |
k += argc; | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment