Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.2k
[3.13] gh-144872: fix heap buffer overflow_PyTokenizer_ensure_utf8 (GH-144807)#145441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -64,6 +64,23 @@ def test_issue7820(self): | ||
| # two bytes in common with the UTF-8 BOM | ||
| self.assertRaises(SyntaxError, eval, b'\xef\xbb\x20') | ||
| def test_truncated_utf8_at_eof(self): | ||
| # Regression test for https://issues.oss-fuzz.com/issues/451112368 | ||
| # Truncated multi-byte UTF-8 sequences at end of input caused an | ||
| # out-of-bounds read in Parser/tokenizer/helpers.c:valid_utf8(). | ||
| truncated = [ | ||
| b'\xc2', # 2-byte lead, missing 1 continuation | ||
| b'\xdf', # 2-byte lead, missing 1 continuation | ||
| b'\xe0', # 3-byte lead, missing 2 continuations | ||
| b'\xe0\xa0', # 3-byte lead, missing 1 continuation | ||
| b'\xf0\x90', # 4-byte lead, missing 2 continuations | ||
| b'\xf0\x90\x80', # 4-byte lead, missing 1 continuation | ||
| b'\xf3', # 4-byte lead, missing 3 (the oss-fuzz reproducer) | ||
| ] | ||
| for seq in truncated: | ||
| with self.subTest(seq=seq): | ||
| self.assertRaises(SyntaxError, compile, seq, '<test>', 'exec') | ||
| @requires_subprocess() | ||
MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. FYI: this line caused the conflict. Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. damn | ||
| def test_20731(self): | ||
| sub = subprocess.Popen([sys.executable, | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Fix heap buffer overflow in the parser found by OSS-Fuzz. |