njn | c2699f6 | 2003-09-05 23:29:33 +0000 | [diff] [blame] | 1 | #include <stdlib.h> |
2 | |||||
3 | int main(void) | ||||
4 | { | ||||
5 | void* x = malloc(10); | ||||
6 | |||||
fitzhardinge | eed7ecb | 2004-01-07 08:47:03 +0000 | [diff] [blame] | 7 | int *x4; |
8 | short *x2; | ||||
9 | char *x1; | ||||
10 | int y4; | ||||
11 | short y2; | ||||
12 | char y1; | ||||
13 | |||||
14 | x4 = x-4; | ||||
15 | x2 = x-4; | ||||
16 | x1 = x-1; | ||||
njn | c2699f6 | 2003-09-05 23:29:33 +0000 | [diff] [blame] | 17 | |
18 | // Invalid reads and writes of sizes 4, 2, 1 | ||||
fitzhardinge | eed7ecb | 2004-01-07 08:47:03 +0000 | [diff] [blame] | 19 | y4 = *x4; |
20 | *x4 = y4; | ||||
21 | |||||
22 | y2 = *x2; | ||||
23 | *x2 = y2; | ||||
24 | |||||
25 | y1 = *x1; | ||||
26 | *x1 = y1; | ||||
njn | c2699f6 | 2003-09-05 23:29:33 +0000 | [diff] [blame] | 27 | |
28 | return 0; | ||||
29 | } |