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

Comparison between pointer and char in MethodMatcher::canonicalize

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 10
    • Fix Version/s: 10
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b31

      Description

      There is a comparison between a pointer and a char in MethodMatcher::canonicalize:

      bool MethodMatcher::canonicalize(char * line, const char *& error_msg) {
        char* colon = strstr(line, "::");
        bool have_colon = (colon != NULL);
        if (have_colon) {
          // Don't allow multiple '::'
          if (colon + 2 != '\0') {
            if (strstr(colon+2, "::")) {
              error_msg = "Method pattern only allows one '::' allowed";
              return false;
            }
          }

      The proper if check would `if (colon[2] != '\0')`. This was also reported by Yasumasa Suenaga.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ehelin Erik Helin
                Reporter:
                ehelin Erik Helin
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: