From 38420eb49e9fadefae793240bf5698984ec8d623 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 21 Oct 2014 02:59:30 +0200 Subject: 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. --- misc/json.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/misc/json.c b/misc/json.c index b301296ebe..8252511408 100644 --- a/misc/json.c +++ b/misc/json.c @@ -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++; } -- cgit v1.2.3