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

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

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1
    • CPU:
      sparc
    • OS:
      solaris_2.5
    • Verification:
      Not verified

      Description

      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)

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: