mirror of
https://github.com/bellard/quickjs.git
synced 2025-12-31 05:39:10 +03:00
\x{N} is a syntax error
This commit is contained in:
22
libregexp.c
22
libregexp.c
@@ -757,9 +757,21 @@ int lre_parse_escape(const uint8_t **pp, int allow_utf16)
|
||||
c = '\v';
|
||||
break;
|
||||
case 'x':
|
||||
{
|
||||
int h0, h1;
|
||||
|
||||
h0 = from_hex(*p++);
|
||||
if (h0 < 0)
|
||||
return -1;
|
||||
h1 = from_hex(*p++);
|
||||
if (h1 < 0)
|
||||
return -1;
|
||||
c = (h0 << 4) | h1;
|
||||
}
|
||||
break;
|
||||
case 'u':
|
||||
{
|
||||
int h, n, i;
|
||||
int h, i;
|
||||
uint32_t c1;
|
||||
|
||||
if (*p == '{' && allow_utf16) {
|
||||
@@ -777,14 +789,8 @@ int lre_parse_escape(const uint8_t **pp, int allow_utf16)
|
||||
}
|
||||
p++;
|
||||
} else {
|
||||
if (c == 'x') {
|
||||
n = 2;
|
||||
} else {
|
||||
n = 4;
|
||||
}
|
||||
|
||||
c = 0;
|
||||
for(i = 0; i < n; i++) {
|
||||
for(i = 0; i < 4; i++) {
|
||||
h = from_hex(*p++);
|
||||
if (h < 0) {
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user