[slf4j-dev] [JIRA] (SLF4J-452) MessageFormatter does not escape backslash correctly

QOS.CH (JIRA) noreply-jira at qos.ch
Sat Feb 2 09:15:00 CET 2019


Nikolay Yurchenko created SLF4J-452:
---------------------------------------

             Summary: MessageFormatter does not escape backslash correctly
                 Key: SLF4J-452
                 URL: https://jira.qos.ch/browse/SLF4J-452
             Project: SLF4J
          Issue Type: Bug
          Components: Core API
         Environment: As a fix for SLF4J-52 rudimentary escape syntax was added. Though it isn't correct.

Now MessageFormatter.arrayFormat() checks only for 2 cases: escaped curly brace ("\\{" - put raw "\{" into log output) and double escaped curly brace ("\\\{" - put raw "\" into log output and use "\{" as parameter start).

But this is incomplete. There may be any number of backslashes:
 * Triple escaped: "\\\\{" - put "\" and "\{" into log output, no parameter start
 * Quadruple escaped: "\\\\\{" - putĀ  "\" and "\" into log output, use "\{" as parameter start
 * Pentaple escaped: "\\\\\\{" - put "\", "\" and "\{" into log output, no parameter start
 * And so on

So even if only check slash escaping before opening curly brace, you must check number of slashes. If the number is odd, curly brace is escaped, if number is even, only backslashes are escaped but not the curly brace.
            Reporter: Nikolay Yurchenko
            Assignee: SLF4J developers list






--
This message was sent by Atlassian JIRA
(v7.3.1#73012)


More information about the slf4j-dev mailing list