Skip to content

Commit 6203962

Browse files
committed
Fix an array index out-of-bound bug
Variable `vararg` indicates the index of vararg in parameter list. While copying kwargs to `buf`, the index `i` should not add `vararg`, which leads to an out-of-bound bug. When there are positional args, vararg and keyword args in a function definition, in which case `vararg` > 1, this bug can be triggered. e.g. ``` pos: object *args: object kw: object ```
1 parent 6793f38 commit 6203962

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/getargs.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2571,7 +2571,7 @@ _PyArg_UnpackKeywordsWithVararg(PyObject *const *args, Py_ssize_t nargs,
25712571
current_arg = NULL;
25722572
}
25732573

2574-
buf[i + vararg + 1] = current_arg;
2574+
buf[i + 1] = current_arg;
25752575

25762576
if (current_arg) {
25772577
--nkwargs;

0 commit comments

Comments
 (0)