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

StringIndexOutOfBoundsException while reading krb5.conf

    Details

    • Subcomponent:
    • Resolved In Build:
      b49
    • OS:
      generic
    • Verification:
      Verified

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.7.0_55"
        Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
        Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Linux app482.auto.mobileiron.com 2.6.18-371.6.1.el5 #1 SMP Wed Mar 12 20:03:51 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux

        A DESCRIPTION OF THE PROBLEM :
        Following Exception coming while parsing "krb5.conf"

        2014-04-17 13:53:12,958 ERROR [UploadSystemBackupImpl] (MIReportScheduler_Worker-2:) Failed to SCP file: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
        java.lang.StringIndexOutOfBoundsException: String index out of range: 0
        at java.lang.String.charAt(String.java:658)
        at sun.security.krb5.Config.trimmed(Config.java:802)
        at sun.security.krb5.Config.parseField(Config.java:819)
        at sun.security.krb5.Config.parseStanzaTable(Config.java:675)
        at sun.security.krb5.Config.<init>(Config.java:171)
        at sun.security.krb5.Config.getInstance(Config.java:96)
        at sun.security.krb5.PrincipalName.<init>(PrincipalName.java:364)
        at sun.security.jgss.krb5.Krb5NameElement.getInstance(Krb5NameElement.java:93)
        at sun.security.jgss.krb5.Krb5MechFactory.getNameElement(Krb5MechFactory.java:95)
        at sun.security.jgss.GSSManagerImpl.getNameElement(GSSManagerImpl.java:202)
        at sun.security.jgss.GSSNameImpl.getElement(GSSNameImpl.java:472)
        at sun.security.jgss.GSSNameImpl.init(GSSNameImpl.java:201)
        at sun.security.jgss.GSSNameImpl.<init>(GSSNameImpl.java:170)
        at sun.security.jgss.GSSNameImpl.<init>(GSSNameImpl.java:151)
        at sun.security.jgss.GSSManagerImpl.createName(GSSManagerImpl.java:127)
        at com.jcraft.jsch.jgss.GSSContextKrb5.create(GSSContextKrb5.java:80)
        at com.jcraft.jsch.UserAuthGSSAPIWithMIC.start(UserAuthGSSAPIWithMIC.java:125)
        at com.jcraft.jsch.Session.connect(Session.java:463)
        at com.jcraft.jsch.Session.connect(Session.java:183)
        at com.mi.middleware.service.impl.UploadSystemBackupImpl.sendViaSCP(UploadSystemBackupImpl.java:820)

        Same "karb5.conf" file successfully getting parsed in Java 6.

        Exception is due to following method which newly added in Java 7

        800 private static String More ...trimmed(String s) {
        801 s = s.trim();
        802 if (s.charAt(0) == '"' && s.charAt(s.length()-1) == '"' ||
        803 s.charAt(0) == '\'' && s.charAt(s.length()-1) == '\'') {
        804 s = s.substring(1, s.length()-1).trim();
        805 }
        806 return s;
        807 }

        REGRESSION. Last worked in version 6u45


        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        2014-04-17 13:53:12,958 ERROR [UploadSystemBackupImpl] (MIReportScheduler_Worker-2:) Failed to SCP file: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
        java.lang.StringIndexOutOfBoundsException: String index out of range: 0
        at java.lang.String.charAt(String.java:658)
        at sun.security.krb5.Config.trimmed(Config.java:802)
        at sun.security.krb5.Config.parseField(Config.java:819)
        at sun.security.krb5.Config.parseStanzaTable(Config.java:675)
        at sun.security.krb5.Config.<init>(Config.java:171)
        at sun.security.krb5.Config.getInstance(Config.java:96)
        at sun.security.krb5.PrincipalName.<init>(PrincipalName.java:364)
        at sun.security.jgss.krb5.Krb5NameElement.getInstance(Krb5NameElement.java:93)
        at sun.security.jgss.krb5.Krb5MechFactory.getNameElement(Krb5MechFactory.java:95)
        at sun.security.jgss.GSSManagerImpl.getNameElement(GSSManagerImpl.java:202)
        at sun.security.jgss.GSSNameImpl.getElement(GSSNameImpl.java:472)
        at sun.security.jgss.GSSNameImpl.init(GSSNameImpl.java:201)
        at sun.security.jgss.GSSNameImpl.<init>(GSSNameImpl.java:170)
        at sun.security.jgss.GSSNameImpl.<init>(GSSNameImpl.java:151)
        at sun.security.jgss.GSSManagerImpl.createName(GSSManagerImpl.java:127)
        at com.jcraft.jsch.jgss.GSSContextKrb5.create(GSSContextKrb5.java:80)
        at com.jcraft.jsch.UserAuthGSSAPIWithMIC.start(UserAuthGSSAPIWithMIC.java:125)
        at com.jcraft.jsch.Session.connect(Session.java:463)
        at com.jcraft.jsch.Session.connect(Session.java:183)
        at com.mi.middleware.service.impl.UploadSystemBackupImpl.sendViaSCP(UploadSystemBackupImpl.java:820)

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        krb5.conf file

        [logging]
         default = FILE:/var/log/krb5libs.log
         kdc = FILE:/var/log/krb5kdc.log
         admin_server = FILE:/var/log/kadmind.log
        [libdefaults]
         default_realm = EXCHCE.COM
         default_keytab_name = FILE:/etc/krb5.keytab
         dns_lookup_realm = false
         dns_lookup_kdc = false
         ticket_lifetime = 24h
         renew_lifetime = 7d
         forwardable = true
        [realms]
         EXCHCE.COM = {
          kdc = prince.exchce.com
          default_domain = exchce.com
          admin_server = prince.exchce.com
         }
        [domain_realm]
         .exchce.com = EXCHCE.COM
         exchce.com = EXCHCE.COM
        ---------- END SOURCE ----------

        SUPPORT :
        YES

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  weijun Weijun Wang
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: