Skip to content

Fix cJSON_Minify for strings ending with an escaped backslash - #1086

Open
prownd wants to merge 1 commit into
DaveGamble:masterfrom
prownd:fix-cJSON_Minify-for-strings-ending-with-an-escaped-backslash-s01
Open

prownd wants to merge 1 commit into
DaveGamble:masterfrom
prownd:fix-cJSON_Minify-for-strings-ending-with-an-escaped-backslash-s01

Conversation

@prownd

@prownd prownd commented Sep 20, 2026

Copy link
Copy Markdown

minify_string() only treated '"' as an escape sequence. For a string ending in an escaped backslash like "a\" the second backslash was considered to escape the closing quote, so the string boundaries got out of sync: whitespace inside following strings was removed and whitespace between tokens was kept, e.g.

{ "a\\" : "b c", "d" : 1 }  ->  {"a\\" : "bc", "d" : 1 }

Skip over any escaped character instead.

minify_string() only treated '\"' as an escape sequence. For a string
ending in an escaped backslash like "a\\" the second backslash was
considered to escape the closing quote, so the string boundaries got out
of sync: whitespace inside following strings was removed and whitespace
between tokens was kept, e.g.

    { "a\\" : "b c", "d" : 1 }  ->  {"a\\" : "bc", "d" : 1 }

Skip over any escaped character instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant