[9] RFR(S): 8139150: ClassVerifier frees exception message while it's still in use
Tobias Hartmann
tobias.hartmann at oracle.com
Thu Oct 8 15:38:08 UTC 2015
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