Integrated: 8263509: LdapSchemaParser.readNextTag checks array length incorrectly

Aleksey Shipilev shade at openjdk.java.net
Tue Mar 16 10:57:11 UTC 2021


On Fri, 12 Mar 2021 13:25:31 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> 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`.
> 
> Additional testing:
>  - [x] Linux x86_64 fastdebug, `com/sun/jndi`

This pull request has now been integrated.

Changeset: 83a9a029
Author:    Aleksey Shipilev <shade at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/83a9a029
Stats:     1 line in 1 file changed: 0 ins; 0 del; 1 mod

8263509: LdapSchemaParser.readNextTag checks array length incorrectly

Reviewed-by: stuefe, aefimov

-------------

PR: https://git.openjdk.java.net/jdk/pull/2968


More information about the core-libs-dev mailing list