summaryrefslogtreecommitdiff
path: root/UBasan-test.cpp
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-08-12 20:02:16 +0200
committerOskar <[email protected]>2024-08-12 20:02:16 +0200
commitc5587e2392d55b3e0dc322c0545ead4a314132c0 (patch)
treea17d39d9fb4c8757968fda32509ffc779a1fcbff /UBasan-test.cpp
parentb42e5076ff9b43027377f71744e9c14935bf788f (diff)
more and UBsanitizer test
Diffstat (limited to 'UBasan-test.cpp')
-rw-r--r--UBasan-test.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/UBasan-test.cpp b/UBasan-test.cpp
index a2d68f5..1cbcfc7 100644
--- a/UBasan-test.cpp
+++ b/UBasan-test.cpp
@@ -5,11 +5,26 @@
/*
*
- *
- *
+ * 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;
}