[Zope-dev] RE BUG: IntSet.c:229 (fwd)

Jim Fulton jim@digicool.com
Wed, 16 Jun 1999 09:45:34 -0400


Anthony Pfrunder wrote:
> 
> ---------- Forwarded message ----------
> Date: Wed, 16 Jun 1999 11:40:42 +1000 (GMT+1000)
> From: Anthony Pfrunder <s341625@student.uq.edu.au>
> To: zope-dev@zope.org
> Subject: BUG: IntSet.c:229
> 
> Hi,
> 
> This is a followup to the IntSet.c:229 bug.  It only segfaults on Win32,
> not linux. 

I'll look at this and see if I can reproduce it.

> It appears to be due to the fact that the
> 
>         self->size
> 
> attribute of the IntSet Extension Class is not initalised when an
> instance is initalised.  This can be verified by putting
> 
>         printf("Len: %i, Size: %i, Ptr: %p",self->len, self->size, self);
> 
> at the top of the int_insert method (line ~200). 

What values are you seeing?

> This causes the
> (paraphased...)
> 
>         if ((self->size >= i) && (int_grow(self, data, l)))
>                 ...
> 
> to short circuit and hence the uninitalised self->data is never
> allocated (in int_grow).  Hence, in the int_modify call it segfaults
> by deref'ing data (*data = ikey) to a random location.
> 
> IntSet appears to have cPersistence.c as its
> superclass (see Import statements in initInt) but I cannot find where
> the actual initalisation is done (cPersistence doesn't have one
> either!!??).

When an ExtensionClass is created, it's data are initialized to NULL, so 
all menbers should be zero.
 
> Could those with much better knowledge of the Components directory of
> Zope2 and Extension Classes in general help me out?

Yes, I'll check it out.  This is very strange.
 
Jim

--
Jim Fulton           mailto:jim@digicool.com   Python Powered!        
Technical Director   (888) 344-4332            http://www.python.org  
Digital Creations    http://www.digicool.com   http://www.zope.org    

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.