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

java.lang.Bignum.modExp() method works wrong

    XMLWordPrintable

    Details

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

      Description

      It should return "this"^"exponent" mod "mod" but may throw an exception
      ==== Here is the minimized test demonstrating the bug ====
      import java.lang.Bignum;
      class java_lang_Bignum_modExp {
        public static void main(String args[]) {
           Bignum b1=new Bignum(100);
           Bignum b2=new Bignum(".5");
           Bignum b3=new Bignum(2);
           System.out.println(b1.modExp(b2,b3)); // should print "0"
        }
      }
      ==== Here is the test output ====
      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: