Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4014587

java.lang.Bignum.createFromRadixString() method works wrong with invalid radix

XMLWordPrintable

    • 1.1
    • sparc
    • solaris_2.5
    • Not verified

      If radix is outside Character.MIN_RADIX..Character.MAX_RADIX, this
      method should throw IllegalArgumentException but
      it either throws ArithmeticException (/ by zero) or returns 0

      ==== Here is the minimized test demonstrating the bug ====
      import java.lang.Bignum;
      class java_lang_Bignum_createFromRadixString {
        public static void main(String args[]) {
          Bignum b1=Bignum.createFromRadixString("1",40);
          System.out.println(b1);
          Bignum b2=Bignum.createFromRadixString("1",1);
          System.out.println(b2);
        }
      }
      ==== Here is the output of the test ====
      0
      java.lang.ArithmeticException: / by zero
      at java.lang.Bignum.createFromRadixString(Bignum.java)
      at java_lang_Bignum_createFromRadixString.main(java_lang_Bignum_createFromRadixString.java:6)

            mhapnersunw Mark Hapner (Inactive)
            mgorshen Mikhail Gorshenev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: