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

LdapSchemaParser.readNextTag checks array length incorrectly

    XMLWordPrintable

Details

    Description

      SonarCloud rightfully says:
        The length of "values" is always ">=0", so update this test to either "==0" or ">0".

              // make sure at least one value was returned
              if(values.length < 0) { // <--- here
                  throw new InvalidAttributeValueException("no values for " +
                                                           "attribute \"" +
                                                           tagName + "\"");
              }

      There is a subsequent access to values[0], which means the failure would throw AIOOB, not InvalidAttributeValueException.

      Attachments

        Issue Links

          Activity

            People

              shade Aleksey Shipilev
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: