codeql: Added integer overflow example

This commit is contained in:
Giulio De Pasquale 2023-02-17 09:54:08 -08:00
parent 495853eaec
commit 20d1f0877e
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 3.10)
project(intof)
add_executable(intof main.c)

View 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;
}