Uploaded image for project: 'Log4cxx'
  1. Log4cxx
  2. LOGCXX-293

Escaped \t \r \n are either not detected or incorrectly translated

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.10.0, 0.11.0
    • 0.11.0
    • Configurator
    • None
    • Any ASCII based system

    Description

      When \n is entered into a property 'n' rather than LF character is entered into the property value.
      The same applies to \r.
      An escapement of tab \t is not recognized because the code looks for '\' followed by backspace character (0x08), when it should look for '\' followed by 't'.

      In the proposed fix below, starting around line 209 of properties.cpp, I have also refactored the get and test out of the case statements of the switch.

      case ELEMENT_ESCAPE:
      switch(c)

      { case 0x74: // 't' element.append(1, '\t'); lexemType = ELEMENT; break; case 0x6E: // 'n' element.append(1, '\n'); lexemType = ELEMENT; break; case 0x72: // 'r' element.append(1, '\r'); lexemType = ELEMENT; break; case 0x20: // ' ' case 0x27: // '\'' case 0x5C: // '\\' case 0x22: // '\"' case 0x3A: // ':' default: element.append(1, c); lexemType = ELEMENT; break; case 0x0A: // '\n' lexemType = ELEMENT_CONTINUE; break; case 0x0D: // '\r' lexemType = ELEMENT_CONTINUE2; break; }

      if (!get(in, c))
      finished = true;
      break;

      Attachments

        Activity

          People

            carnold@apache.org Curt Arnold
            mbartosik Mark Bartosik
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: