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

java.lang.Bignum.modExp() method may throw ArrayIndexOutOfBoundsException

XMLWordPrintable

    • 1.1
    • sparc
    • solaris_2.5
    • Not verified

      When exponent is negative, this Bignum is 0, method should throw
      ArithmeticException but throws ArrayIndexOutOfBoundsException
      ==== Here is the minimzied test demonstrating the bug ====
      import java.lang.Bignum;
      class java_lang_Bignum_modExp {
        public static void main(String args[]) {
           Bignum b1=new Bignum(0);
           Bignum b2=new Bignum(-5);
           Bignum b3=new Bignum(3);
           System.out.println(b1.modExp(b2,b3));
        }
      }
      ==== Here is the output of the test ====
      java.lang.ArrayIndexOutOfBoundsException: -1
      at java.lang.Bignum.mul0(Bignum.java)
      at java.lang.Bignum.modExp(Bignum.java)
      at java_lang_Bignum_modExp.main(java_lang_Bignum_modExp.java:7)

            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: