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

Method::checked_resolve_jmethod_id() could do better checks

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 12
    • Fix Version/s: 18
    • Component/s: hotspot
    • Labels:
      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

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

                Dates

                Created:
                Updated:
                Resolved: