RFR: 8321540: ClassSignature.parseFrom() throws StringIndexOutOfBoundsException for invalid signatures
Jaikiran Pai
jpai at openjdk.org
Tue Jan 2 07:20:37 UTC 2024
On Mon, 11 Dec 2023 15:17:49 GMT, Adam Sotona <asotona at openjdk.org> wrote:
> ClassFile API models and parses signatures, however parsing of the signatures mostly throws IIOBE when it fails.
> This patch improves SignaturesImpl parsing methods implementation and errors handling and adds relevant negative tests.
> The parser is not an ultimate signatures validator yet, however this is a step forward to it.
>
> Please review.
>
> Thanks,
> Adam
Hello Adam, these changes look fine to me. Please update the copyright year on `SignaturesImpl.java` before integrating.
I'm guessing you have intentionally not included the original `IndexOutOfBoundsException` as a cause in the `IllegalArgumentException` that gets thrown.
Also, it appears that the `SignaturesImpl` is more like an utility class and isn't expected to be used in multi-thread access and thus the reliance on the (non final) instance field `sig` appears OK.
-------------
Marked as reviewed by jpai (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/17058#pullrequestreview-1800020682
More information about the core-libs-dev
mailing list