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

Severin Gehwolf sgehwolf at openjdk.org
Wed Dec 7 10:57:12 UTC 2022


On Wed, 7 Dec 2022 09:43:23 GMT, Thomas Stuefe <stuefe 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.
>
>> 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.

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

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


More information about the hotspot-runtime-dev mailing list