@@ -10049,7 +10049,7 @@ static int skip_spaces(const char *pc)
10049
10049
if (!((c >= 0x09 && c <= 0x0d) || (c == 0x20)))
10050
10050
break;
10051
10051
} else {
10052
- c = utf8_decode(p - 1, UTF8_CHAR_LEN_MAX, &p_next);
10052
+ c = utf8_decode(p - 1, &p_next);
10053
10053
/* no need to test for invalid UTF-8, 0xFFFD is not a space */
10054
10054
if (!lre_is_space(c))
10055
10055
break;
@@ -18724,7 +18724,7 @@ static __exception int js_parse_template_part(JSParseState *s,
18724
18724
s->eol = &p[-1];
18725
18725
s->mark = p;
18726
18726
} else if (c >= 0x80) {
18727
- c = utf8_decode(p - 1, UTF8_CHAR_LEN_MAX, &p_next);
18727
+ c = utf8_decode(p - 1, &p_next);
18728
18728
if (p_next == p) {
18729
18729
js_parse_error(s, "invalid UTF-8 sequence");
18730
18730
goto fail;
@@ -18830,7 +18830,7 @@ static __exception int js_parse_string(JSParseState *s, int sep,
18830
18830
}
18831
18831
goto fail;
18832
18832
} else if (c >= 0x80) {
18833
- c = utf8_decode(p, UTF8_CHAR_LEN_MAX, &p_next);
18833
+ c = utf8_decode(p, &p_next);
18834
18834
if (p_next == p + 1) {
18835
18835
goto invalid_utf8;
18836
18836
}
@@ -18856,7 +18856,7 @@ static __exception int js_parse_string(JSParseState *s, int sep,
18856
18856
break;
18857
18857
}
18858
18858
} else if (c >= 0x80) {
18859
- c = utf8_decode(p - 1, UTF8_CHAR_LEN_MAX, &p_next);
18859
+ c = utf8_decode(p - 1, &p_next);
18860
18860
if (p_next == p)
18861
18861
goto invalid_utf8;
18862
18862
p = p_next;
@@ -18928,7 +18928,7 @@ static __exception int js_parse_regexp(JSParseState *s)
18928
18928
else if (c == '\0' && p >= s->buf_end)
18929
18929
goto eof_error;
18930
18930
else if (c >= 0x80) {
18931
- c = utf8_decode(p - 1, UTF8_CHAR_LEN_MAX, &p_next);
18931
+ c = utf8_decode(p - 1, &p_next);
18932
18932
if (p_next == p) {
18933
18933
goto invalid_utf8;
18934
18934
}
@@ -18937,7 +18937,7 @@ static __exception int js_parse_regexp(JSParseState *s)
18937
18937
goto eol_error;
18938
18938
}
18939
18939
} else if (c >= 0x80) {
18940
- c = utf8_decode(p - 1, UTF8_CHAR_LEN_MAX, &p_next);
18940
+ c = utf8_decode(p - 1, &p_next);
18941
18941
if (p_next == p) {
18942
18942
invalid_utf8:
18943
18943
js_parse_error(s, "invalid UTF-8 sequence");
@@ -18957,7 +18957,7 @@ static __exception int js_parse_regexp(JSParseState *s)
18957
18957
18958
18958
/* flags */
18959
18959
for(;;) {
18960
- c = utf8_decode(p, UTF8_CHAR_LEN_MAX, &p_next);
18960
+ c = utf8_decode(p, &p_next);
18961
18961
/* no need to test for invalid UTF-8, 0xFFFD is not ident_next */
18962
18962
if (!lre_js_is_ident_next(c))
18963
18963
break;
@@ -19031,7 +19031,7 @@ static JSAtom parse_ident(JSParseState *s, const uint8_t **pp,
19031
19031
c = lre_parse_escape(&p_next, TRUE);
19032
19032
*pident_has_escape = TRUE;
19033
19033
} else if (c >= 0x80) {
19034
- c = utf8_decode(p, UTF8_CHAR_LEN_MAX, &p_next);
19034
+ c = utf8_decode(p, &p_next);
19035
19035
/* no need to test for invalid UTF-8, 0xFFFD is not ident_next */
19036
19036
}
19037
19037
if (!lre_js_is_ident_next(c))
@@ -19135,7 +19135,7 @@ static __exception int next_token(JSParseState *s)
19135
19135
s->got_lf = TRUE; /* considered as LF for ASI */
19136
19136
p++;
19137
19137
} else if (*p >= 0x80) {
19138
- c = utf8_decode(p, UTF8_CHAR_LEN_MAX, &p);
19138
+ c = utf8_decode(p, &p);
19139
19139
/* ignore invalid UTF-8 in comments */
19140
19140
if (c == CP_LS || c == CP_PS) {
19141
19141
s->got_lf = TRUE; /* considered as LF for ASI */
@@ -19156,7 +19156,7 @@ static __exception int next_token(JSParseState *s)
19156
19156
if (*p == '\r' || *p == '\n')
19157
19157
break;
19158
19158
if (*p >= 0x80) {
19159
- c = utf8_decode(p, UTF8_CHAR_LEN_MAX, &p);
19159
+ c = utf8_decode(p, &p);
19160
19160
/* ignore invalid UTF-8 in comments */
19161
19161
/* LS or PS are considered as line terminator */
19162
19162
if (c == CP_LS || c == CP_PS) {
@@ -19256,7 +19256,7 @@ static __exception int next_token(JSParseState *s)
19256
19256
if (c == '\\' && *p_next == 'u') {
19257
19257
c = lre_parse_escape(&p_next, TRUE);
19258
19258
} else if (c >= 0x80) {
19259
- c = utf8_decode(p, UTF8_CHAR_LEN_MAX, &p_next);
19259
+ c = utf8_decode(p, &p_next);
19260
19260
if (p_next == p + 1)
19261
19261
goto invalid_utf8;
19262
19262
}
@@ -19328,7 +19328,7 @@ static __exception int next_token(JSParseState *s)
19328
19328
goto fail;
19329
19329
/* reject `10instanceof Number` */
19330
19330
if (JS_VALUE_IS_NAN(ret) ||
19331
- lre_js_is_ident_next(utf8_decode(p, UTF8_CHAR_LEN_MAX, &p_next))) {
19331
+ lre_js_is_ident_next(utf8_decode(p, &p_next))) {
19332
19332
JS_FreeValue(s->ctx, ret);
19333
19333
js_parse_error(s, "invalid number literal");
19334
19334
goto fail;
@@ -19521,7 +19521,7 @@ static __exception int next_token(JSParseState *s)
19521
19521
break;
19522
19522
default:
19523
19523
if (c >= 0x80) { /* non-ASCII code-point */
19524
- c = utf8_decode(p, UTF8_CHAR_LEN_MAX, &p_next);
19524
+ c = utf8_decode(p, &p_next);
19525
19525
if (p_next == p + 1)
19526
19526
goto invalid_utf8;
19527
19527
p = p_next;
@@ -19631,7 +19631,7 @@ static int json_parse_string(JSParseState *s, const uint8_t **pp)
19631
19631
}
19632
19632
} else
19633
19633
if (c >= 0x80) {
19634
- c = utf8_decode(p - 1, s->buf_end - p, &p_next);
19634
+ c = utf8_decode(p - 1, &p_next);
19635
19635
if (p_next == p) {
19636
19636
json_parse_error(s, p - 1, "Bad UTF-8 sequence");
19637
19637
goto fail;
@@ -19835,7 +19835,7 @@ static __exception int json_next_token(JSParseState *s)
19835
19835
break;
19836
19836
default:
19837
19837
if (c >= 0x80) {
19838
- c = utf8_decode(p, s->buf_end - p, &p_next);
19838
+ c = utf8_decode(p, &p_next);
19839
19839
if (p_next == p + 1) {
19840
19840
js_parse_error(s, "Unexpected token '\\x%02x' in JSON", *p);
19841
19841
} else {
@@ -19958,7 +19958,7 @@ static void skip_shebang(const uint8_t **pp, const uint8_t *buf_end)
19958
19958
if (*p == '\n' || *p == '\r') {
19959
19959
break;
19960
19960
} else if (*p >= 0x80) {
19961
- c = utf8_decode(p, UTF8_CHAR_LEN_MAX, &p);
19961
+ c = utf8_decode(p, &p);
19962
19962
/* purposely ignore UTF-8 encoding errors in this comment line */
19963
19963
if (c == CP_LS || c == CP_PS)
19964
19964
break;
0 commit comments