summaryrefslogtreecommitdiffstats
path: root/core/io/json.cpp
diff options
context:
space:
mode:
authorRedMser <redmser.jj2@gmail.com>2022-09-20 18:28:01 +0200
committerRedMser <redmser.jj2@gmail.com>2023-06-30 21:28:36 +0200
commit427b293c7d2c40f92f4bf2a3a744659896b8120b (patch)
tree3c4d36019900e7518090facf4da089892889bb30 /core/io/json.cpp
parent46424488edc341b65467ee7fd3ac423e4d49ad34 (diff)
downloadredot-engine-427b293c7d2c40f92f4bf2a3a744659896b8120b.tar.gz
Disallow invalid escape sequences in JSON.parse
Diffstat (limited to 'core/io/json.cpp')
-rw-r--r--core/io/json.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/io/json.cpp b/core/io/json.cpp
index a6e054a9fe..496400a5ea 100644
--- a/core/io/json.cpp
+++ b/core/io/json.cpp
@@ -299,9 +299,15 @@ Error JSON::_get_token(const char32_t *p_str, int &index, int p_len, Token &r_to
}
} break;
- default: {
+ case '"':
+ case '\\':
+ case '/': {
res = next;
} break;
+ default: {
+ r_err_str = "Invalid escape sequence.";
+ return ERR_PARSE_ERROR;
+ }
}
str += res;