pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/commit/4dfcdbe22c1901221faf11444a7e8a7bc4ab4c16

[3.13] gh-148157: Check for `_PyPegen_add_type_comment_to_arg` fail i… · python/cpython@4dfcdbe · GitHub
Skip to content

Commit 4dfcdbe

Browse files
[3.13] gh-148157: Check for _PyPegen_add_type_comment_to_arg fail in _PyPegen_name_default_pair (GH-148158) (#148163)
(cherry picked from commit 1795fcc) Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent 9b576f1 commit 4dfcdbe

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

Lib/test/test_type_comments.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,9 @@ def test_non_utf8_type_comment_with_ignore_cookie(self):
398398
with self.assertRaises(UnicodeDecodeError):
399399
_testcapi.Py_CompileStringExFlags(
400400
b"a=1 # type: \x80", "<test>", 256, flags)
401+
with self.assertRaises(UnicodeDecodeError):
402+
_testcapi.Py_CompileStringExFlags(
403+
b"def a(f=8, #type: \x80\n\x80", "<test>", 256, flags)
401404

402405
def test_func_type_input(self):
403406

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix an unlikely crash when parsing an invalid type comments for function
2+
parameters. Found by OSS Fuzz in :oss-fuzz:`492782951`.

Parser/action_helpers.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,9 @@ _PyPegen_name_default_pair(Parser *p, arg_ty arg, expr_ty value, Token *tc)
434434
return NULL;
435435
}
436436
a->arg = _PyPegen_add_type_comment_to_arg(p, arg, tc);
437+
if (!a->arg) {
438+
return NULL;
439+
}
437440
a->value = value;
438441
return a;
439442
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy