[Numpy-discussion] fromfile can segfault if data is corrupted
Tue Dec 15 12:20:11 CST 2009
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
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the NumPy-Discussion