mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-29 04:21:42 +03:00
fix parser bug allowing illegal unicode escape
This commit is contained in:
parent
d6266102c3
commit
5b4cc494c1
@ -113,6 +113,10 @@ impl Token {
|
||||
|
||||
if unicode {
|
||||
let string = input_tendril.to_string();
|
||||
if &string[string.len() - 1..] != "}" {
|
||||
return None;
|
||||
}
|
||||
|
||||
let unicode_number = &string[3..string.len() - 1];
|
||||
let len = unicode_number.len();
|
||||
if !(1..=6).contains(&len) {
|
||||
|
@ -18,12 +18,14 @@ outputs:
|
||||
- " --> test:1:1\n |\n 1 | '\\1'\n | ^\n |\n = unexpected token: '''"
|
||||
- " --> test:1:1\n |\n 1 | '\\9'\n | ^\n |\n = unexpected token: '''"
|
||||
- " --> test:1:1\n |\n 1 | '\\*'\n | ^\n |\n = unexpected token: '''"
|
||||
- " --> test:1:1\n |\n 1 | '\\x'\n | ^\n |\n = unexpected token: '''"
|
||||
- " --> test:1:1\n |\n 1 | '\\u'\n | ^\n |\n = unexpected token: '''"
|
||||
- " --> test:1:1\n |\n 1 | '\\u{bbbbb}\\u{aaaa}'\n | ^\n |\n = unexpected token: '''"
|
||||
- " --> test:1:1\n |\n 1 | '\\uz'\n | ^\n |\n = unexpected token: '''"
|
||||
- " --> test:1:1\n |\n 1 | '\\u1'\n | ^\n |\n = unexpected token: '''"
|
||||
- " --> test:1:1\n |\n 1 | '\\u123'\n | ^\n |\n = unexpected token: '''"
|
||||
- " --> test:1:1\n |\n 1 | \\u{2764z'\n | ^\n |\n = unexpected token: '\\'"
|
||||
- " --> test:1:1\n |\n 1 | \\u{276g}'\n | ^\n |\n = unexpected token: '\\'"
|
||||
- " --> test:1:1\n |\n 1 | '\\u{2764z'\n | ^\n |\n = unexpected token: '''"
|
||||
- " --> test:1:1\n |\n 1 | '\\u{276g}'\n | ^\n |\n = unexpected token: '''"
|
||||
- " --> test:1:1\n |\n 1 | '\\u00000000'\n | ^\n |\n = unexpected token: '''"
|
||||
- " --> test:1:1\n |\n 1 | '\\u01000000'\n | ^\n |\n = unexpected token: '''"
|
||||
- " --> test:1:1\n |\n 1 | '\\u9999999'\n | ^\n |\n = unexpected token: '''"
|
||||
|
@ -31,8 +31,8 @@ expectation: Fail
|
||||
'\uz'
|
||||
'\u1'
|
||||
'\u123'
|
||||
\u{2764z'
|
||||
\u{276g}'
|
||||
'\u{2764z'
|
||||
'\u{276g}'
|
||||
'\u00000000'
|
||||
'\u01000000'
|
||||
'\u9999999'
|
||||
|
Loading…
Reference in New Issue
Block a user