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
31
32
33
34
35
36
37
38
39
#include <stdio.h>
#include <stdlib.h>
void simple_check_path_in_function(){
// read in integer
int myInt;
scanf("%d", &myInt);
// provoke integer overflow
void *m = malloc(myInt * 8);
// free data
if (m != NULL)
free(m);
}
int read_int(){
int myInt;
scanf("%d", &myInt);
return myInt;
}
void check_path_across_functions(){
int i = read_int();
// provoke integer overflow
void *m = malloc(i * 8);
// free data
if (m != NULL)
free(m);
}
int main(void)
{
simple_check_path_in_function();
check_path_across_functions();
return 0;
}