@@ -10049,7 +10049,7 @@ static int skip_spaces(const char *pc)
1004910049 if (!((c >= 0x09 && c <= 0x0d) || (c == 0x20)))
1005010050 break;
1005110051 } else {
10052- c = utf8_decode(p - 1, UTF8_CHAR_LEN_MAX, &p_next);
10052+ c = utf8_decode(p - 1, &p_next);
1005310053 /* no need to test for invalid UTF-8, 0xFFFD is not a space */
1005410054 if (!lre_is_space(c))
1005510055 break;
@@ -18724,7 +18724,7 @@ static __exception int js_parse_template_part(JSParseState *s,
1872418724 s->eol = &p[-1];
1872518725 s->mark = p;
1872618726 } else if (c >= 0x80) {
18727- c = utf8_decode(p - 1, UTF8_CHAR_LEN_MAX, &p_next);
18727+ c = utf8_decode(p - 1, &p_next);
1872818728 if (p_next == p) {
1872918729 js_parse_error(s, "invalid UTF-8 sequence");
1873018730 goto fail;
@@ -18830,7 +18830,7 @@ static __exception int js_parse_string(JSParseState *s, int sep,
1883018830 }
1883118831 goto fail;
1883218832 } else if (c >= 0x80) {
18833- c = utf8_decode(p, UTF8_CHAR_LEN_MAX, &p_next);
18833+ c = utf8_decode(p, &p_next);
1883418834 if (p_next == p + 1) {
1883518835 goto invalid_utf8;
1883618836 }
@@ -18856,7 +18856,7 @@ static __exception int js_parse_string(JSParseState *s, int sep,
1885618856 break;
1885718857 }
1885818858 } else if (c >= 0x80) {
18859- c = utf8_decode(p - 1, UTF8_CHAR_LEN_MAX, &p_next);
18859+ c = utf8_decode(p - 1, &p_next);
1886018860 if (p_next == p)
1886118861 goto invalid_utf8;
1886218862 p = p_next;
@@ -18928,7 +18928,7 @@ static __exception int js_parse_regexp(JSParseState *s)
1892818928 else if (c == '\0' && p >= s->buf_end)
1892918929 goto eof_error;
1893018930 else if (c >= 0x80) {
18931- c = utf8_decode(p - 1, UTF8_CHAR_LEN_MAX, &p_next);
18931+ c = utf8_decode(p - 1, &p_next);
1893218932 if (p_next == p) {
1893318933 goto invalid_utf8;
1893418934 }
@@ -18937,7 +18937,7 @@ static __exception int js_parse_regexp(JSParseState *s)
1893718937 goto eol_error;
1893818938 }
1893918939 } else if (c >= 0x80) {
18940- c = utf8_decode(p - 1, UTF8_CHAR_LEN_MAX, &p_next);
18940+ c = utf8_decode(p - 1, &p_next);
1894118941 if (p_next == p) {
1894218942 invalid_utf8:
1894318943 js_parse_error(s, "invalid UTF-8 sequence");
@@ -18957,7 +18957,7 @@ static __exception int js_parse_regexp(JSParseState *s)
1895718957
1895818958 /* flags */
1895918959 for(;;) {
18960- c = utf8_decode(p, UTF8_CHAR_LEN_MAX, &p_next);
18960+ c = utf8_decode(p, &p_next);
1896118961 /* no need to test for invalid UTF-8, 0xFFFD is not ident_next */
1896218962 if (!lre_js_is_ident_next(c))
1896318963 break;
@@ -19031,7 +19031,7 @@ static JSAtom parse_ident(JSParseState *s, const uint8_t **pp,
1903119031 c = lre_parse_escape(&p_next, TRUE);
1903219032 *pident_has_escape = TRUE;
1903319033 } else if (c >= 0x80) {
19034- c = utf8_decode(p, UTF8_CHAR_LEN_MAX, &p_next);
19034+ c = utf8_decode(p, &p_next);
1903519035 /* no need to test for invalid UTF-8, 0xFFFD is not ident_next */
1903619036 }
1903719037 if (!lre_js_is_ident_next(c))
@@ -19135,7 +19135,7 @@ static __exception int next_token(JSParseState *s)
1913519135 s->got_lf = TRUE; /* considered as LF for ASI */
1913619136 p++;
1913719137 } else if (*p >= 0x80) {
19138- c = utf8_decode(p, UTF8_CHAR_LEN_MAX, &p);
19138+ c = utf8_decode(p, &p);
1913919139 /* ignore invalid UTF-8 in comments */
1914019140 if (c == CP_LS || c == CP_PS) {
1914119141 s->got_lf = TRUE; /* considered as LF for ASI */
@@ -19156,7 +19156,7 @@ static __exception int next_token(JSParseState *s)
1915619156 if (*p == '\r' || *p == '\n')
1915719157 break;
1915819158 if (*p >= 0x80) {
19159- c = utf8_decode(p, UTF8_CHAR_LEN_MAX, &p);
19159+ c = utf8_decode(p, &p);
1916019160 /* ignore invalid UTF-8 in comments */
1916119161 /* LS or PS are considered as line terminator */
1916219162 if (c == CP_LS || c == CP_PS) {
@@ -19256,7 +19256,7 @@ static __exception int next_token(JSParseState *s)
1925619256 if (c == '\\' && *p_next == 'u') {
1925719257 c = lre_parse_escape(&p_next, TRUE);
1925819258 } else if (c >= 0x80) {
19259- c = utf8_decode(p, UTF8_CHAR_LEN_MAX, &p_next);
19259+ c = utf8_decode(p, &p_next);
1926019260 if (p_next == p + 1)
1926119261 goto invalid_utf8;
1926219262 }
@@ -19328,7 +19328,7 @@ static __exception int next_token(JSParseState *s)
1932819328 goto fail;
1932919329 /* reject `10instanceof Number` */
1933019330 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))) {
1933219332 JS_FreeValue(s->ctx, ret);
1933319333 js_parse_error(s, "invalid number literal");
1933419334 goto fail;
@@ -19521,7 +19521,7 @@ static __exception int next_token(JSParseState *s)
1952119521 break;
1952219522 default:
1952319523 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);
1952519525 if (p_next == p + 1)
1952619526 goto invalid_utf8;
1952719527 p = p_next;
@@ -19631,7 +19631,7 @@ static int json_parse_string(JSParseState *s, const uint8_t **pp)
1963119631 }
1963219632 } else
1963319633 if (c >= 0x80) {
19634- c = utf8_decode(p - 1, s->buf_end - p, &p_next);
19634+ c = utf8_decode(p - 1, &p_next);
1963519635 if (p_next == p) {
1963619636 json_parse_error(s, p - 1, "Bad UTF-8 sequence");
1963719637 goto fail;
@@ -19835,7 +19835,7 @@ static __exception int json_next_token(JSParseState *s)
1983519835 break;
1983619836 default:
1983719837 if (c >= 0x80) {
19838- c = utf8_decode(p, s->buf_end - p, &p_next);
19838+ c = utf8_decode(p, &p_next);
1983919839 if (p_next == p + 1) {
1984019840 js_parse_error(s, "Unexpected token '\\x%02x' in JSON", *p);
1984119841 } else {
@@ -19958,7 +19958,7 @@ static void skip_shebang(const uint8_t **pp, const uint8_t *buf_end)
1995819958 if (*p == '\n' || *p == '\r') {
1995919959 break;
1996019960 } else if (*p >= 0x80) {
19961- c = utf8_decode(p, UTF8_CHAR_LEN_MAX, &p);
19961+ c = utf8_decode(p, &p);
1996219962 /* purposely ignore UTF-8 encoding errors in this comment line */
1996319963 if (c == CP_LS || c == CP_PS)
1996419964 break;
0 commit comments