Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8213466

Method::checked_resolve_jmethod_id() could do better checks

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Duplicate
    • P4
    • 18
    • 12
    • hotspot
    • None

    Description

      Method* Method::checked_resolve_jmethod_id(jmethodID mid) {
        if (mid == NULL) return NULL;
        Method* o = resolve_jmethod_id(mid);
        if (o == NULL || o == JNIMethodBlock::_free_method || !((Metadata*)o)->is_method()) {
          return NULL;
        }
        return o;
      };

      We could, in addition, test that:
      - Method* is a valid metaspace pointer
      - Method* is a method

      see Metaspace::contains() and Method::is_valid_method(), respectively.

      Can be done either unconditionally, or at least as assert, if it costs too much time.



      Attachments

        Issue Links

          Activity

            People

              coleenp Coleen Phillimore
              stuefe Thomas Stuefe
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: