RFR: 8329728: Read long lines in ClassListParser [v5]

Ioi Lam iklam at openjdk.org
Thu Apr 18 03:56:58 UTC 2024


On Wed, 10 Apr 2024 17:54:25 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> Today the `ClassListParser` has a hard-coded limit of 4096 chars for each line in the CDS class list file. However, it's possible for a line to be much longer than than (64KB for the class name, plus extra information that can include path names, IDs, etc).
>> 
>> I wrote a utility class `LineReader` that automatically allocates a buffer before calling `fgets()`. Hopefully this can be useful for other cases where we call `fgets()` with a fixed buffer size.
>> 
>> Max line width is limited to 4M to simplify testing (and avoid running into corner cases when we approach INT_MAX).
>
> Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
> 
>  - Merge branch 'master' into 8329728-read-arbitrary-long-lines-in-class-list-parser
>  - @dholmes-ora and @calvinccheung comments
>  - Check class name for valid UTF8 encoding
>  - @matias9927 and @calvinccheung comments - limit line to 4M. Added gtest cases. Test for class names > 64K
>  - 8329728: Read arbitrarily long lines in ClassListParser

> _Mailing list message from [ioi.lam at oracle.com](mailto:ioi.lam at oracle.com) on [hotspot-dev](mailto:hotspot-dev at mail.openjdk.org):_
> 
> Hi John,
> 
> Thanks for posting the code. Let me try to rebase your code onto mainline, and then apply my ClassListParser changes on top of that. I will probably open a new PR that combines this PR (#18669) and yours (#18773). Let see how that looks and we can decide how to proceed.


I have integrated John's code and created an alternative PR: https://github.com/openjdk/jdk/pull/18833 . I think it's a much better foundation for going forward and cleaning up the technical debt in HotSpot.

Please take a look.

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

PR Comment: https://git.openjdk.org/jdk/pull/18669#issuecomment-2062942771


More information about the hotspot-dev mailing list