codeql: Added integer overflow example
This commit is contained in:
parent
495853eaec
commit
20d1f0877e
5
codeql/samples/integer_overflow/CMakeLists.txt
Normal file
5
codeql/samples/integer_overflow/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
project(intof)
|
||||
|
||||
add_executable(intof main.c)
|
14
codeql/samples/integer_overflow/main.c
Normal file
14
codeql/samples/integer_overflow/main.c
Normal file
@ -0,0 +1,14 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int sum(int a, int b) { return a + b; }
|
||||
|
||||
int main() {
|
||||
int x = 2147483647;
|
||||
int y = 2;
|
||||
int z = x + sum(y, y);
|
||||
|
||||
printf("z = %d\n", z);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user