cephes_smirnov nan-to-int conversion bug (Trac #1638) #2163
Labels
defect
A clear bug or issue that prevents SciPy from being installed or used as expected
Migrated from Trac
scipy.special
Milestone
Original ticket http://projects.scipy.org/scipy/ticket/1638 on 2012-03-30 by @pv, assigned to @pv.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=653948
http://permalink.gmane.org/gmane.comp.python.scientific.devel/16262
The
cephes_smirnov
function inkolmogorov.c
can go into a very long loop, due to the following line of codeIf
e
happens to benan
, the value ofnn
is unspecified. It is used as a loop upper bound, so it will effectively hang the process.The cast miraculously seems to work OK (gives zero?) on x86, but produces large numbers on MIPS.
There are probably also other instances of this bug in the code. All float-to-integer casts where the operand may be NAN probably should be guarded by
n = (int)x; if (x - n != 0) { mtherr(...); return NPY_NAN; }
or something like that (this would also protect against integer overflow).The text was updated successfully, but these errors were encountered: