1:
2: #include <malloc.h>
3: #include <stdio.h>
4: #include <string.h>
5:
6: #define size_t unsigned int
7:
8: int
9: main (int argc, char *argv[])
10: {
11: char *dummy0;
12: char *dummy1;
13: char *fill_info_table1;
14: char *over_top;
15: size_t over_top_size = 0x3000;
16: char *over_top_dup;
17: size_t over_top_dup_size = 0x7000;
18: char *x;
19: size_t i;
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31: dummy0 = malloc (0x3fa000);
32:
33: dummy1 = malloc (0x3fa000);
34:
35: fill_info_table1 = malloc (0x3000);
36:
37:
38: x = malloc (0x1000);
39: free (x);
40:
41:
42:
43:
44:
45:
46: over_top = malloc (over_top_size);
47: over_top_dup = malloc (over_top_dup_size);
48: memset (over_top, 0, over_top_size);
49: memset (over_top_dup, 1, over_top_dup_size);
50:
51: for (i = 0; i < over_top_size; ++i)
52: if (over_top[i] != 0)
53: {
54: printf ("FAIL: malloc expands info table\n");
55: return 0;
56: }
57:
58: for (i = 0; i < over_top_dup_size; ++i)
59: if (over_top_dup[i] != 1)
60: {
61: printf ("FAIL: malloc expands info table\n");
62: return 0;
63: }
64:
65: printf ("PASS: malloc expands info table\n");
66: return 0;
67: }