[Numpy-discussion] fromfile can segfault if data is corrupted

Charles R Harris charlesr.harris at gmail.com
Tue Dec 15 13:28:43 EST 2009


On Tue, Dec 15, 2009 at 11:20 AM, Michael Droettboom <mdroe at stsci.edu>wrote:

> I just discovered a bug in fromfile where it can segfault if the file data
> is corrupted in such a way that the array size is insanely large.  (It was a
> byte-swapping problem in my own code, but it would be preferable to get an
> exception rather than a crash).
>
> It's a simple fix to propagate the "array too large" exception before
> trying to dereference the NULL array pointer (ret) in PyArray_FromFile (see
> attached patch).  But my question is: is this an appropriate fix for 1.4 (it
> seems pretty straightforward), or should I only make this to the trunk?
>
>
David can weigh in here, but I think you should backport it. It's a bugfix,
small, and there is going to be another rc.

On the other hand, Travis should stop backporting new functionality.

<snip>

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20091215/2f85c5e9/attachment.html>


More information about the NumPy-Discussion mailing list