View · Search · Index
No registered users in community xowiki
in last 10 minutes

[Xotcl] Memory trash in 0.9.3 and 0.9.4

From: Zoran Vasiljevic <zoran_at_archiware.com>
Date: Mon, 4 Mar 2002 12:15:37 +0100

In file xotcl.c:

static int
XOTclCNewMethod(ClientData cd, Tcl_Interp* in, int objc, Tcl_Obj *objv[]) {
  XOTclClass *cl = XOTclObjectToClass(cd);
  XOTclObject *obj = &cl->object;
  Tcl_Obj *cname, *autoname;
  char *name, *n;
  int result, offset=1;
  DEFINE_NEW_TCL_OBJECTS_ON_STACK(objc+1, ov);

  /* ^^^^^^ */
   
Should read:

  DEFINE_NEW_TCL_OBJECTS_ON_STACK(objc+2, ov);

... because later in file, ov[0] and ov[1] are
reserved for internal use and other arguments
are copied over which results in trashing memory.

Cheers
Zoran