RFR: 8339134: Callers of Exceptions::fthrow should ensure exception message lengths avoid the INT_MAX limits of os::vsnprintf [v2]
Coleen Phillimore
coleenp at openjdk.org
Mon Nov 4 15:32:32 UTC 2024
On Mon, 4 Nov 2024 09:02:10 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> This is mostly an audit of the callers of `Exceptions::fthrow` to ensure unbounded strings can't appear.
>>
>> There is a code change in DiagnosticCmd parsing to extend the string length limit already used in part of that code.
>>
>> Testing:
>> - tier 1-3 (sanity)
>>
>> Thanks
>
> David Holmes has updated the pull request incrementally with one additional commit since the last revision:
>
> Restore previous behaviour for zero length strings
src/hotspot/share/utilities/exceptions.cpp line 264:
> 262: // will be within reasonable limits - specifically we will never hit the INT_MAX limit
> 263: // of os::vsnprintf when it tries to report how big a buffer is needed. Even so we
> 264: // further limit the formatted output to 1024 characters.
If we're chopping off the message at 1024 characters, why do we have to audit the callers? Is it because vsnprintf will overflow before truncating the message? Seems like it could be easy to add a caller that breaks this. There's no way to check here?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21867#discussion_r1827926037
More information about the serviceability-dev
mailing list