...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <stddef.h>
/* #include <stdlib.h> is missing */
int main(void) {
for (size_t i = 0; i < 100; ++i) {
/* int malloc() assumed */
char *ptr = (char *)malloc(0x10000000);
*ptr = 'a';
}
return 0;
}
|
When compiled with Microsoft Visual Studio (a C90-only platform) 2013 for a 64-bit platform, this noncompliant code example will eventually cause an access violation when dereferencing ptr
in the loop.
...