Skip to content

Commit

Permalink
#12: clear locals at vm init
Browse files Browse the repository at this point in the history
Some systems do not bzero the stack memory.
Fixes some errors found with valgrind and AddressSanitizer
settuple, i.e. test/classes/monkey.pn works now
  • Loading branch information
Reini Urban committed Feb 24, 2013
1 parent f11bc3c commit 0275bfa
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ PN potion_vm(Potion *P, PN proto, PN self, PN vargs, PN_SIZE upc, PN *upargs) {

if (pos == 0) {
reg[-1] = reg[0] = self;
if (f->localsize)
memset((void*)locals, 0, sizeof(*locals) * f->localsize);
if (upc > 0 && upargs != NULL) {
PN_SIZE i;
for (i = 0; i < upc; i++) {
Expand Down

0 comments on commit 0275bfa

Please sign in to comment.