diff options
author | RedMser <redmser.jj2@gmail.com> | 2022-09-20 18:28:01 +0200 |
---|---|---|
committer | RedMser <redmser.jj2@gmail.com> | 2023-06-30 21:28:36 +0200 |
commit | 427b293c7d2c40f92f4bf2a3a744659896b8120b (patch) | |
tree | 3c4d36019900e7518090facf4da089892889bb30 /core/io/json.cpp | |
parent | 46424488edc341b65467ee7fd3ac423e4d49ad34 (diff) | |
download | redot-engine-427b293c7d2c40f92f4bf2a3a744659896b8120b.tar.gz |
Disallow invalid escape sequences in JSON.parse
Diffstat (limited to 'core/io/json.cpp')
-rw-r--r-- | core/io/json.cpp | 8 |
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; |