[Numpy-discussion] fromfile (binary) double free or corruption

Scott Ransom sransom at nrao.edu
Sun Mar 2 14:52:06 EST 2008


Hi Travis,

That fixes the problem that I reported such that there is no glibc
issue anymore.

However, it does result in a change in behaviour for fromfile.

Previously, when no data was returned an exception was raised.
With the new fix there is no exception, and an empty array is
returned.  Code (like mine) that depended on an exception being
thrown at EOF will break.  I've fixed my code, but this could bite
others.

Thanks for the prompt fix.

Scott


On Sun, Mar 02, 2008 at 10:36:05AM -0600, Travis E. Oliphant wrote:
> Scott Ransom wrote:
> >
> >
> > Seems like the bad call is the Py_DECREF(ret); on line 6316 of
> > multiarraymodule.c, which occurs just after a PyDataMem_RENEW()
> > (i.e. realloc) call.
> >
> > I tried to find recent changes in svn that might have caused this,
> > but couldn't see anything that seemed relevant.  One thing that
> > has changed recently on my system is that I'm now using the new
> > glibc (v2.7) on Debian unstable.
> >   
> This looks like the behavior of realloc has changed when called with 0 
> as the size.    We should avoid calling realloc with a size of 0 as it 
> looks like the behavior is different depending on libc.
> 
> Please check out the latest SVN and see if my fix improves things.
> 
> -Travis O.
> 
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion

-- 
-- 
Scott M. Ransom            Address:  NRAO
Phone:  (434) 296-0320               520 Edgemont Rd.
email:  sransom at nrao.edu             Charlottesville, VA 22903 USA
GPG Fingerprint: 06A9 9553 78BE 16DB 407B  FFCA 9BFA B6FF FFD3 2989



More information about the NumPy-Discussion mailing list