Skip to content

Commit dfff858

Browse files
committed
Overwrite free'd elements of SRE's data stack.
1 parent 2e220f2 commit dfff858

File tree

1 file changed

+6
-1
lines changed
  • graalpython/com.oracle.graal.python.cext/modules

1 file changed

+6
-1
lines changed

graalpython/com.oracle.graal.python.cext/modules/sre_lib.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,15 +459,20 @@ do { \
459459
"(%" PY_FORMAT_SIZE_T "d)\n", \
460460
data, state->data_stack_base-size, size)); \
461461
memcpy(data, state->data_stack+state->data_stack_base-size, size); \
462-
if (discard) \
462+
if (discard) { \
463+
/* TODO: workaround for Sulong realloc bug */ \
464+
memset(state->data_stack+state->data_stack_base-size, 0, size); \
463465
state->data_stack_base -= size; \
466+
} \
464467
} while (0)
465468

466469
#define DATA_STACK_POP_DISCARD(state, size) \
467470
do { \
468471
TRACE(("discard data from %" PY_FORMAT_SIZE_T "d " \
469472
"(%" PY_FORMAT_SIZE_T "d)\n", \
470473
state->data_stack_base-size, size)); \
474+
/* TODO: workaround for Sulong realloc bug */ \
475+
memset(state->data_stack+state->data_stack_base-size, 0, size); \
471476
state->data_stack_base -= size; \
472477
} while(0)
473478

0 commit comments

Comments
 (0)