1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fill uninitialized memory with int3

This commit is contained in:
Maxime Chevalier-Boisvert 2021-04-06 11:24:58 -04:00 committed by Alan Wu
parent 131fc9c074
commit 3d53ee1761

View file

@ -3,6 +3,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
@ -154,6 +155,10 @@ uint8_t* alloc_exec_mem(uint32_t mem_size)
exit(-1); exit(-1);
} }
// Fill the executable memory with 0x13 so that
// executing uninitialized memory will fault
memset(mem_block, 0xCC, mem_size);
return mem_block; return mem_block;
#else #else
return NULL; return NULL;