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

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

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.10.0, 0.11.0
    • Fix Version/s: 0.11.0
    • Component/s: Configurator
    • Labels:
      None
    • Environment:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: