RFR: 8329728: Read long lines in ClassListParser [v2]
Calvin Cheung
ccheung at openjdk.org
Wed Apr 10 05:40:09 UTC 2024
On Tue, 9 Apr 2024 17:22:47 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 incrementally with one additional commit since the last revision:
>
> @matias9927 and @calvinccheung comments - limit line to 4M. Added gtest cases. Test for class names > 64K
src/hotspot/share/utilities/lineReader.hpp line 43:
> 41: bool _is_oom;
> 42: public:
> 43: static const int MAX_LEN = 4 * 1024 * 1024;
How about `4 * M` instead of `4 * 1024 * 1024`?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18669#discussion_r1558847183
More information about the hotspot-dev
mailing list