summaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-21 02:59:30 +0200
committerwm4 <wm4@nowhere>2014-10-21 02:59:30 +0200
commit38420eb49e9fadefae793240bf5698984ec8d623 (patch)
treea6971e63862eee91cc9f43a02a68733b74cd96f3 /misc
parentbbf4a8aa5db9e1e49ae639941ef0c0a2392c75f8 (diff)
downloadmpv-38420eb49e9fadefae793240bf5698984ec8d623.tar.bz2
mpv-38420eb49e9fadefae793240bf5698984ec8d623.tar.xz
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.
Diffstat (limited to 'misc')
-rw-r--r--misc/json.c5
1 files 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++;
}