]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-117376: Fix off-by-ones in conversion functions (GH-124301)
authorKen Jin <kenjin@python.org>
Wed, 25 Sep 2024 18:41:07 +0000 (02:41 +0800)
committerGitHub <noreply@github.com>
Wed, 25 Sep 2024 18:41:07 +0000 (02:41 +0800)
Fix off-by-ones in conversion function

Python/bytecodes.c
Python/executor_cases.c.h
Python/generated_cases.c.h

index bf8f6af83fc56e021fa3e3ba33a7be36d2a95aa3..0fd396f1319e78b487f26b9502827ce2e25cf43e 100644 (file)
@@ -3928,7 +3928,7 @@ dummy_func(
             PyCFunctionFastWithKeywords cfunc =
                 (PyCFunctionFastWithKeywords)(void(*)(void))meth->ml_meth;
 
-            STACKREFS_TO_PYOBJECTS(args, nargs, args_o);
+            STACKREFS_TO_PYOBJECTS(args, total_args, args_o);
             if (CONVERSION_FAILED(args_o)) {
                 DECREF_INPUTS();
                 ERROR_IF(true, error);
@@ -4009,7 +4009,7 @@ dummy_func(
                 (PyCFunctionFast)(void(*)(void))meth->ml_meth;
             int nargs = total_args - 1;
 
-            STACKREFS_TO_PYOBJECTS(args, nargs, args_o);
+            STACKREFS_TO_PYOBJECTS(args, total_args, args_o);
             if (CONVERSION_FAILED(args_o)) {
                 DECREF_INPUTS();
                 ERROR_IF(true, error);
index 7285acec0bacaf6c4f994a6fd8c1d0e7e35748ae..7a9c6ab89c38cce850e235069aa39b2d9bb4aec3 100644 (file)
             int nargs = total_args - 1;
             PyCFunctionFastWithKeywords cfunc =
             (PyCFunctionFastWithKeywords)(void(*)(void))meth->ml_meth;
-            STACKREFS_TO_PYOBJECTS(args, nargs, args_o);
+            STACKREFS_TO_PYOBJECTS(args, total_args, args_o);
             if (CONVERSION_FAILED(args_o)) {
                 PyStackRef_CLOSE(callable);
                 PyStackRef_CLOSE(self_or_null[0]);
             PyCFunctionFast cfunc =
             (PyCFunctionFast)(void(*)(void))meth->ml_meth;
             int nargs = total_args - 1;
-            STACKREFS_TO_PYOBJECTS(args, nargs, args_o);
+            STACKREFS_TO_PYOBJECTS(args, total_args, args_o);
             if (CONVERSION_FAILED(args_o)) {
                 PyStackRef_CLOSE(callable);
                 PyStackRef_CLOSE(self_or_null[0]);
index 58792a2101ab28f351dfab2fcb55751cf1fbaf53..1201fe82efb91985f3c7d60943ea4ad98656bbb8 100644 (file)
                 PyCFunctionFast cfunc =
                 (PyCFunctionFast)(void(*)(void))meth->ml_meth;
                 int nargs = total_args - 1;
-                STACKREFS_TO_PYOBJECTS(args, nargs, args_o);
+                STACKREFS_TO_PYOBJECTS(args, total_args, args_o);
                 if (CONVERSION_FAILED(args_o)) {
                     PyStackRef_CLOSE(callable);
                     PyStackRef_CLOSE(self_or_null[0]);
                 int nargs = total_args - 1;
                 PyCFunctionFastWithKeywords cfunc =
                 (PyCFunctionFastWithKeywords)(void(*)(void))meth->ml_meth;
-                STACKREFS_TO_PYOBJECTS(args, nargs, args_o);
+                STACKREFS_TO_PYOBJECTS(args, total_args, args_o);
                 if (CONVERSION_FAILED(args_o)) {
                     PyStackRef_CLOSE(callable);
                     PyStackRef_CLOSE(self_or_null[0]);