Menu

Bug in Kolmogorov-Smirnov test version 0.3.3

Gilad
2014-04-07
2014-04-07
  • Gilad

    Gilad - 2014-04-07

    , I’ve encountered a major bug in the sort function implemented within the package, which affects the possibility of using the package.

    The bug is encountered in the sort method within Kolmogorov-Smirnov in the following lines (180 - 183):

    if (a[n - 1] < 0)
    for (int i = n - 1; a[i] < 0; i--)
    data[numNegs++] = Double.longBitsToDouble(a[i]);
    if (numNegs > 0)
    for (int i = numNegs; i < n; i++)
    data[i] = Double.longBitsToDouble(a[i - numNegs]);

    Consider the case of an array including all negative numbers. In this case the first for loop will never meet a stop condition, and will run out of bound. There should be a condition verifying that the loop is within array bounds.

    Same thing happens with the same for loop, in which numNegs is increased, and causes (i-numNegs) to be out of bounds.

     
  • Roby Joehanes

    Roby Joehanes - 2014-04-07

    Thank you! This is fixed in version 0.3.4.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.