12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #include <malloc.h>
- #include <stdio.h>
- #include <string.h>
- #define size_t unsigned int
- char *dummy0;
- char *dummy1;
- char *fill_info_table1;
- int
- main (int argc, char *argv[])
- {
- char *over_top;
- size_t over_top_size = 0x3000;
- char *over_top_dup;
- size_t over_top_dup_size = 0x7000;
- char *x;
- size_t i;
-
-
- dummy0 = malloc (0x3fa000);
-
- dummy1 = malloc (0x3fa000);
-
- fill_info_table1 = malloc (0x3000);
-
- x = malloc (0x1000);
- free (x);
-
-
- over_top = malloc (over_top_size);
- over_top_dup = malloc (over_top_dup_size);
- memset (over_top, 0, over_top_size);
- memset (over_top_dup, 1, over_top_dup_size);
- for (i = 0; i < over_top_size; ++i)
- if (over_top[i] != 0)
- {
- printf ("FAIL: malloc expands info table\n");
- return 0;
- }
- for (i = 0; i < over_top_dup_size; ++i)
- if (over_top_dup[i] != 1)
- {
- printf ("FAIL: malloc expands info table\n");
- return 0;
- }
- printf ("PASS: malloc expands info table\n");
- return 0;
- }
|