Solr
  1. Solr
  2. SOLR-2819

Wrong isHex()-method in HTMLStripCharFilter

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 3.4
    • Fix Version/s: 3.6, 4.0-ALPHA
    • Component/s: None
    • Labels:
      None

      Description

      In org.apache.solr.analysis HTMLStripCharFilter use a wrong isHex()-method that return characters like 'X', 'Y' as valid hex chars:

        private boolean isHex(int ch) {
          return (ch>='0' && ch<='9') ||
                 (ch>='A' && ch<='Z') ||
                 (ch>='a' && ch<='z');
        }
      

      If only characters from [0-9a-zA-Z] are allowed, the readNumericEntity method will detect faster a mismatch.

        Activity

        Hide
        Hoss Man added a comment -

        Nice catch Bernhard!

        I think this is a new record for "time between bug introduced in code and bug reported" ... from what i can tell this has been in there since Solr 1.0 (but as you point out, didn't actually cause bad behavior since the final integer parsing would result in a MISMATCH and backtracking.

        Still good to fix it though – thank you for reporting it.

        Committed revision 1208032. - trunk
        Committed revision 1208037. - 3x

        Show
        Hoss Man added a comment - Nice catch Bernhard! I think this is a new record for "time between bug introduced in code and bug reported" ... from what i can tell this has been in there since Solr 1.0 (but as you point out, didn't actually cause bad behavior since the final integer parsing would result in a MISMATCH and backtracking. Still good to fix it though – thank you for reporting it. Committed revision 1208032. - trunk Committed revision 1208037. - 3x

          People

          • Assignee:
            Hoss Man
            Reporter:
            Bernhard Berger
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development