RFR: 8263509: LdapSchemaParser.readNextTag checks array length incorrectly
Aleksey Shipilev
shade at openjdk.java.net
Fri Mar 12 13:31:16 UTC 2021
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`
-------------
Commit messages:
- 8263509: LdapSchemaParser.readNextTag checks array length incorrectly
Changes: https://git.openjdk.java.net/jdk/pull/2968/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2968&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8263509
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.java.net/jdk/pull/2968.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/2968/head:pull/2968
PR: https://git.openjdk.java.net/jdk/pull/2968
More information about the core-libs-dev
mailing list