Skip to content
Snippets Groups Projects
Commit 8b7453ed authored by Peter Limkilde Svendsen's avatar Peter Limkilde Svendsen
Browse files

Add test of calloc with overflow

parent c54db6f0
No related branches found
No related tags found
1 merge request!188add calloc integer overflow check
...@@ -18,6 +18,10 @@ int main(int argc, char ** argv) { ...@@ -18,6 +18,10 @@ int main(int argc, char ** argv) {
} }
free(ptrc); free(ptrc);
char * ptrco = (char *)calloc(SIZE_MAX, SIZE_MAX);
printf("calloc (overflowing) %p\n", ptrco);
free(ptrco); /* clean up correctly even if overflow is not handled */
char * ptra = (char *)memalign(256, 256); char * ptra = (char *)memalign(256, 256);
printf("memalign %p\n", ptra); printf("memalign %p\n", ptra);
for(i = 0; i < 256; i++) { for(i = 0; i < 256; i++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment