RFR: JDK-8280004: DCmdArgument<jlong>::parse_value() should handle NULL input

Thomas Stuefe stuefe at openjdk.java.net
Tue Jan 18 06:18:26 UTC 2022


On Tue, 18 Jan 2022 02:30:27 GMT, David Holmes <dholmes at openjdk.org> wrote:

> Hi Thomas,
> 
> Are you sure about the removal of the copying? I can't quite convince myself that the original string from the command line will still be allocated by the time the exception gets propagated and accessed.
> 
> Thanks, David

Hi David,

the function calls `Exceptions::fthrow`, which calls os::vsnprintf right away and uses yet another temporary buffer, in that case, stack-based:

https://github.com/openjdk/jdk/blob/39f140a20120300074167597580f9be34e812cad/src/hotspot/share/utilities/exceptions.cpp#L259-L267

So this patch just moves the snprintf call two lines further down, and removes the need for one of the temp buffers. But it still resolved the exception text in the context of this function. Or am I misunderstanding you?

Cheers, Thomas

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

PR: https://git.openjdk.java.net/jdk/pull/7079


More information about the hotspot-runtime-dev mailing list