mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-36495: Fix two out-of-bounds array reads (GH-12641)
Research and fix by @bradlarsen.
This commit is contained in:
parent
10654c19b5
commit
a4d7836239
1 changed files with 2 additions and 2 deletions
|
@ -1400,7 +1400,7 @@ handle_keywordonly_args(struct compiling *c, const node *n, int start,
|
||||||
goto error;
|
goto error;
|
||||||
asdl_seq_SET(kwonlyargs, j++, arg);
|
asdl_seq_SET(kwonlyargs, j++, arg);
|
||||||
i += 1; /* the name */
|
i += 1; /* the name */
|
||||||
if (TYPE(CHILD(n, i)) == COMMA)
|
if (i < NCH(n) && TYPE(CHILD(n, i)) == COMMA)
|
||||||
i += 1; /* the comma, if present */
|
i += 1; /* the comma, if present */
|
||||||
break;
|
break;
|
||||||
case TYPE_COMMENT:
|
case TYPE_COMMENT:
|
||||||
|
@ -1599,7 +1599,7 @@ ast_for_arguments(struct compiling *c, const node *n)
|
||||||
if (!kwarg)
|
if (!kwarg)
|
||||||
return NULL;
|
return NULL;
|
||||||
i += 2; /* the double star and the name */
|
i += 2; /* the double star and the name */
|
||||||
if (TYPE(CHILD(n, i)) == COMMA)
|
if (i < NCH(n) && TYPE(CHILD(n, i)) == COMMA)
|
||||||
i += 1; /* the comma, if present */
|
i += 1; /* the comma, if present */
|
||||||
break;
|
break;
|
||||||
case TYPE_COMMENT:
|
case TYPE_COMMENT:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue