Repository: lucy-clownfish Updated Branches: refs/heads/master 8316e7c2d -> 603c26133
Zero memory in Class_Init_Obj Make sure that ivars of objects allocated via CFISH_ALLOCA_OBJ are initialized to zero. Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/58705108 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/58705108 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/58705108 Branch: refs/heads/master Commit: 58705108abed9ed7b5ddf52a189cbcf3e82211db Parents: e0fd278 Author: Nick Wellnhofer <[email protected]> Authored: Mon May 11 21:52:19 2015 +0200 Committer: Nick Wellnhofer <[email protected]> Committed: Tue May 12 18:34:59 2015 +0200 ---------------------------------------------------------------------- runtime/c/src/Clownfish/Class.c | 3 +++ runtime/go/ext/clownfish.c | 2 ++ runtime/perl/xs/XSBind.c | 2 ++ 3 files changed, 7 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/58705108/runtime/c/src/Clownfish/Class.c ---------------------------------------------------------------------- diff --git a/runtime/c/src/Clownfish/Class.c b/runtime/c/src/Clownfish/Class.c index fc495c5..0b1491a 100644 --- a/runtime/c/src/Clownfish/Class.c +++ b/runtime/c/src/Clownfish/Class.c @@ -18,6 +18,8 @@ #define C_CFISH_OBJ #define C_CFISH_CLASS +#include <string.h> + #include "charmony.h" #include "Clownfish/Class.h" @@ -36,6 +38,7 @@ Class_Make_Obj_IMP(Class *self) { Obj* Class_Init_Obj_IMP(Class *self, void *allocation) { + memset(allocation, 0, self->obj_alloc_size); Obj *obj = (Obj*)allocation; obj->klass = self; obj->refcount = 1; http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/58705108/runtime/go/ext/clownfish.c ---------------------------------------------------------------------- diff --git a/runtime/go/ext/clownfish.c b/runtime/go/ext/clownfish.c index e5d54e0..c6f5f0b 100644 --- a/runtime/go/ext/clownfish.c +++ b/runtime/go/ext/clownfish.c @@ -22,6 +22,7 @@ #include <stdio.h> #include <stdlib.h> +#include <string.h> #include "charmony.h" @@ -135,6 +136,7 @@ Class_Make_Obj_IMP(Class *self) { Obj* Class_Init_Obj_IMP(Class *self, void *allocation) { + memset(allocation, 0, self->obj_alloc_size); Obj *obj = (Obj*)allocation; obj->klass = self; obj->refcount = 1; http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/58705108/runtime/perl/xs/XSBind.c ---------------------------------------------------------------------- diff --git a/runtime/perl/xs/XSBind.c b/runtime/perl/xs/XSBind.c index ef7069a..be0bf1b 100644 --- a/runtime/perl/xs/XSBind.c +++ b/runtime/perl/xs/XSBind.c @@ -15,6 +15,7 @@ */ #include <ctype.h> +#include <string.h> #define C_CFISH_OBJ #define C_CFISH_CLASS @@ -768,6 +769,7 @@ CFISH_Class_Make_Obj_IMP(cfish_Class *self) { cfish_Obj* CFISH_Class_Init_Obj_IMP(cfish_Class *self, void *allocation) { + memset(allocation, 0, self->obj_alloc_size); cfish_Obj *obj = (cfish_Obj*)allocation; obj->klass = self; obj->ref.count = (1 << XSBIND_REFCOUNT_SHIFT) | XSBIND_REFCOUNT_FLAG;
