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

Comparison between pointer and char in MethodMatcher::canonicalize

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 10
    • 10
    • hotspot
    • None
    • b31

      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.

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

              Created:
              Updated:
              Resolved: