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

INI parser does not properly handled backslashes at end of values

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Resolved
    • 1.2.3
    • 1.5.3
    • Configuration
    • 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

        Issue Links

          Activity

            People

              Unassigned Unassigned
              atomicknight atomicknight
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 4.5h
                  4.5h