RFR: 8272096: Exceptions::new_exception can return wrong exception [v3]

David Holmes dholmes at openjdk.org
Mon Jul 18 06:34:48 UTC 2022


On Fri, 15 Jul 2022 15:09:07 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> I added an assert if Exceptions::new_exception is called with a pending exception and fixed the places where it is called with a pending exception.   That leaves only two possible exceptions. I left the product mode code in to return the pending exception if allocating the exception message doesn't thrown OOM because it was always there and seems dubious.  Tested with jck tests and tier1-7.
>
> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   second get_user_name_slow call should CHECK_NULL too.

You have changed behaviour - even if things are actually more correct. For example given:

 ```
if (tag == ITEM_Object) {
    u2 class_index = _stream->get_u2(CHECK_NT);
    int nconstants = _cp->length();
    if ((class_index <= 0 || class_index >= nconstants) ||
        (!_cp->tag_at(class_index).is_klass() &&
         !_cp->tag_at(class_index).is_unresolved_klass())) {
      _stream->stackmap_format_error("bad class index", THREAD);
      return VerificationType::bogus_type();
}

If the `get_u2` now fails due to classfile truncation then we will throw that exception instead of the "bad class index" fomrat error.

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

PR: https://git.openjdk.org/jdk/pull/9492


More information about the hotspot-dev mailing list