aboutsummaryrefslogtreecommitdiff
path: root/qobject/json-parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'qobject/json-parser.c')
-rw-r--r--qobject/json-parser.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/qobject/json-parser.c b/qobject/json-parser.c
index 273f448a52..63e9229f1c 100644
--- a/qobject/json-parser.c
+++ b/qobject/json-parser.c
@@ -144,7 +144,8 @@ static QString *parse_string(JSONParserContext *ctxt, JSONToken *token)
while (*ptr != quote) {
assert(*ptr);
- if (*ptr == '\\') {
+ switch (*ptr) {
+ case '\\':
beg = ptr++;
switch (*ptr++) {
case '"':
@@ -205,7 +206,14 @@ static QString *parse_string(JSONParserContext *ctxt, JSONToken *token)
parse_error(ctxt, token, "invalid escape sequence in string");
goto out;
}
- } else {
+ break;
+ case '%':
+ if (ctxt->ap) {
+ parse_error(ctxt, token, "can't interpolate into string");
+ goto out;
+ }
+ /* fall through */
+ default:
cp = mod_utf8_codepoint(ptr, 6, &end);
if (cp < 0) {
parse_error(ctxt, token, "invalid UTF-8 sequence in string");