Skip to content

Commit 92a02c1

Browse files
authored
Fix tokenizer error when raw decoding null bytes (GH-25080)
1 parent 09b90a0 commit 92a02c1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Parser/tokenizer.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,9 @@ tok_readline_raw(struct tok_state *tok)
813813
tok_concatenate_interactive_new_line(tok, line) == -1) {
814814
return 0;
815815
}
816+
if (*tok->inp == '\0') {
817+
return 0;
818+
}
816819
tok->inp = strchr(tok->inp, '\0');
817820
} while (tok->inp[-1] != '\n');
818821
return 1;
@@ -963,7 +966,7 @@ tok_underflow_file(struct tok_state *tok) {
963966
if (tok->lineno > 2) {
964967
tok->decoding_state = STATE_NORMAL;
965968
}
966-
else if (!check_coding_spec(tok->cur, tok->end - tok->cur,
969+
else if (!check_coding_spec(tok->cur, strlen(tok->cur),
967970
tok, fp_setreadl))
968971
{
969972
return 0;

0 commit comments

Comments
 (0)