summaryrefslogtreecommitdiff
path: root/UBasan-test.cpp
blob: 1cbcfc7099b86cf8cf144a5d97e78b58cc516e0e (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
#include <iostream>
#include <vector>
#include "sales_data.hpp"
#include "sales_item.hpp"

/*
 *
 * Found out about UBsanitizer so i just wanted to try it out!
 * Some examples in here that trigger the sanitizer. Obviously not all examples.
 *
 */

int main () {
	
	int arr[] = {1,2,3,4,5,6,7,8,9,10};
	int *val = arr + 11;
	std::cout << val << std::endl;
	double a = 10;
	std::cout << "Input a 0: " << std::endl;
	std::cin >> a;
	double b = 10 / a;
	std::cout << b << std::endl;

	int c = 10;
	std::cout << "Input a 0: " << std::endl;
	std::cin >> c;
	int d = 10 / c;
	std::cout << d << std::endl;
	return 0;
}