Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-6395

[classlib][luni] Arrays.sort(double []) will result in StackOverflowError for specific arrays input

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.0M11
    • Fix Version/s: 5.0M13
    • Component/s: Classlib
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      There is a simple testcase as below. You can see StackOverflowError if run this testcase. This is a defect of Arrays.sort(double []), I have attached a fix for it.

      import java.util.Arrays;

      public class SortTest {
      public static void main(String[] args) {
      double[] array =

      { Double.NaN, 1.0, 2.0, Double.NaN, Double.NaN, 3.0, 4.0 }

      ;
      displayArray(array);
      Arrays.sort(array);
      displayArray(array);

      System.out.println();
      }

      private static void displayArray(double[] array)

      { for (double d : array) System.out.print(d + " "); System.out.println(); }

      }

        Attachments

        1. harmony-6395-2.patch
          5 kB
          Tim Ellison
        2. HARMONY-6395.diff
          3 kB
          Jim Yu

          Activity

            People

            • Assignee:
              qiuxiaox Sean Qiu
              Reporter:
              junjie0122 Jim Yu
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: