json: handle >\\"< fragments correctly
It assumed that any >\"< sequence was an escape for >"<, but that is not
the case with JSON such as >{"ducks":"\\"}<. In this case, the second
>\< is obviously not starting an escape.
This commit is contained in:
1 parent
bbf4a8aa5d
commit
38420eb49e
1 file changed
+3
-2
+3
-2
@@ -85,8 +85,9 @@ static int read_str(void *ta_parent, struct mpv_node *dst, char **src)
|
||||
while (cur[0] && cur[0] != '"') {
|
||||
if (cur[0] == '\\') {
|
||||
has_escapes = true;
|
||||
if (cur[1] == '"')
|
||||
cur++; // skip \"
|
||||
// skip >\"< and >\\< (latter to handle >\\"< correctly)
|
||||
if (cur[1] == '"' || cur[1] == '\\')
|
||||
cur++;
|
||||
}
|
||||
cur++;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user