[9] RFR(S): 8139150: ClassVerifier frees exception message while it's still in use

Tobias Hartmann tobias.hartmann at oracle.com
Fri Oct 9 07:07:25 UTC 2015


Thanks, Zoltán!

Best,
Tobias

On 08.10.2015 17:51, Zoltán Majó wrote:
> Hi Tobias,
> 
> 
> the fix looks good to me. (I'm not a *R*eviewer.)
> 
> Best regards,
> 
> 
> Zoltan
> 
> On 10/08/2015 05:38 PM, Tobias Hartmann wrote:
>> Hi,
>>
>> please review the following patch.
>>
>> https://bugs.openjdk.java.net/browse/JDK-8139150
>> http://cr.openjdk.java.net/~thartmann/8139150/webrev.00/
>>
>> Problem:
>> If class verification fails in StackMapReader::parse_verification_type(), ClassVerifier::class_format_error() is invoked to pass the error message. The method allocates a new string and saves it in ClassVerifier::_message. The problem is that the caller creates a new ResourceMark that leads to _message being deallocated after return. However, later in Verifier::verify() we call ClassVerifier::exception_message() to get the message and pass it on.
>>
>> Solution:
>> We should not create a ResourceMark here. There is a top level ResourceMark in Verifier::verify() that will take care of freeing the memory allocated in ClassVerifier::class_format_error().
>>
>> Tested with JPRT and the failing testcase.
>>
>> Thanks,
>> Tobias
> 


More information about the hotspot-dev mailing list