RFR: JDK-8298248: Limit sscanf output width in cgroup file parsers

Thomas Stuefe stuefe at openjdk.org
Wed Dec 7 11:16:55 UTC 2022


On Wed, 7 Dec 2022 10:53:15 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:

>>> This doesn't give me a good feeling - the 1023 is 1024-1 but the two are completely independent as expressed. Ideally this would be handled inside the macro but that in turn passes things to `subsystem_file_line_contents` and so there is no easy way to express that the width limit is related to the `bufsize`. :(
>>> 
>>> So I reluctantly approve.
>> 
>> Yes, this also bugged me. Specifying buffer size twice, with -1 offset no less, seems error-prone. The thing is that the format specifier handed in is not always just "%s", sometimes its more, with suppressed matchers (e.g. "%s %*d").
>> 
>> With the explicit width specifiers I followed what other incarnations of this macro already do, so I did not make it worse. A code revamp would be certainly nice.
>
> @tstuefe Sorry, I changed the typo in the bug synopsis. Please change it in the PR title and the ready label should appear again.

@jerboaa I had to look close to spot it :-)

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

PR: https://git.openjdk.org/jdk/pull/11554


More information about the hotspot-runtime-dev mailing list