Uploaded image for project: 'Shiro'
  1. Shiro
  2. SHIRO-530

INI parser does not properly handled backslashes at end of values

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.3
    • Fix Version/s: None
    • Component/s: Configuration
    • Labels:
      None

      Description

      The backslash character is overloaded for use as a continuation delimiter as well as an escape character. However, the parsing logic does not presently handle this character consistently, which prevents the use of odd numbers of backslashes at the end of values. Here is a matrix of examples:

      Original value Parsed value Notes
      key=value\
      
      key=value
      
      Backslash treated as continuation delimiter
      key=value\\
      
      key=value\\
      
      Backslashes treated as literal characters
      key=value\\\
      
      key=value\\
      
      Final backslash treated as continuation delimiter, other backslashes treated as literal characters
      key=value\\\\
      
      key=value\\\\
      
      Backslashes treated as literal characters

      There is a comment in Ini.Section#isContinued(String) that states:

      //find the number of backslashes at the end of the line. If an even number, the
      //backslashes are considered escaped. If an odd number, the line is considered continued on the next line

      However, there is no unescaping logic in either Ini.Section#toMapProps(String) (which calls #isContinued) or IniSection#splitKeyValue(String).

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              atomicknight atomicknight
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: