coheigea opened a new pull request, #3140:
URL: https://github.com/apache/cxf/pull/3140

   When the parser scanned a JSON string to find where it ended, it checked 
whether a closing " was escaped by looking at the single character immediately 
before it. If that character was a \, it assumed the quote was escaped and kept 
scanning.
   
   That works for \" (an escaped quote), but is wrong for \\". Two backslashes 
means the first \ escapes the second one — they cancel out — and the " after 
them is the real end of the string. The parser saw \ before the " and 
incorrectly treated it as still inside the string, so it skipped past the 
closing quote, swallowed the following comma, and consumed the rest of the JSON 
as part of the value. Any keys that came after were silently lost.
   
   Instead of looking back one character, the fix counts all consecutive 
backslashes immediately before the ". If the count is odd, there's one 
unmatched \ left over that really does escape the quote. If the count is even 
(including zero), all the backslashes pair up and the " is a genuine string 
boundary.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to