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:
wm4 2014-10-21 02:59:30 +02:00
parent bbf4a8aa5d
commit 38420eb49e
1 changed files with 3 additions and 2 deletions

View File

@ -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++;
}