> Rfc2253Parser silently accepted an empty RDN (no attributeTypeAndValue pair)
> instead of
> throwing InvalidNameException. Rdn.getType()/getValue() then indexed an empty
> internal list, throwing an uncaught IndexOutOfBoundsException instead of the
> documented
> exception.
>
> Two independent entry points:
>
> Rdn("") - the original fuzzer-found crash.
> LdapName("cn=x,") / LdapName.add("") - a string with a trailing , or ;, which
> never goes
> through Rdn(String) at all (LdapName builds the RDN directly via
> Rfc2253Parser).
>
> Add one check, rdn.size() == 0, throw InvalidNameException, placed in
>
> Rfc2253Parser.doParse(Rdn) - the single method both paths funnel through.
>
> Also add a regression check that "cn=a,,cn=b" still throws as before.
>
>
>
>
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK
> Interim AI Policy](https://openjdk.org/legal/ai).
Timofei Fedotov has updated the pull request incrementally with one additional
commit since the last revision:
Add regression test
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/32648/files
- new: https://git.openjdk.org/jdk/pull/32648/files/0f0145ad..6b7bd408
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=32648&range=03
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=32648&range=02-03
Stats: 122 lines in 1 file changed: 122 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/32648.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/32648/head:pull/32648
PR: https://git.openjdk.org/jdk/pull/32648