On Mon, 21 Sep 2026 07:23:53 GMT, Matthias Baesken <[email protected]> wrote:

>> src/jdk.jdwp.agent/share/native/libjdwp/signature.c line 49:
>> 
>>> 47:     if (tagPtr == NULL) {
>>> 48:         EXIT_ERROR(AGENT_ERROR_NULL_POINTER, "Invalid method 
>>> signature");
>>> 49:     }
>> 
>> request->methodSignature is setup by the following:
>> 
>>     error = methodSignature(method, NULL, &request->methodSignature,  NULL);
>> 
>> methodSignature() does the following:
>> 
>>     error = JVMTI_FUNC_PTR(gdata->jvmti,GetMethodName)
>>             (gdata->jvmti, method, &name, &signature, &generic_signature);
>> 
>> And then:
>> 
>>     if ( psignature != NULL ) {
>>         *psignature = signature;
>> 
>> psignature is the &request->methodSignature argument. So this is how it gets 
>> setup. I don't see how strchr(signature, SIGNATURE_END_ARGS) can ever fail. 
>> It would mean a bug in the JVMTI or the debug agent, which we should be 
>> catching with an assert in debug builds as we currently do, not with an 
>> EXIT_ERROR that applies to all builds.
>
> Could there be something overwritten in the signature in error cases, that 
> leads to 'bad'/broken method signatures?

That sill sounds like a bug that should be caught with an assert. I don't see 
how GCC can make any assumptions about a string returned by GetMethodName(). It 
has to have a SIGNATURE_END_ARGS in it. GCC can't know that, but that shouldn't 
lead to it to thinking strchr can return NULL in this case.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32929#discussion_r4063453925

Reply via email to