Skip to content

Commit cbdeda8

Browse files
gh-96821: Fix undefined behaviour in _testcapimodule.c (GH-96915)
* gh-96821: Assert for demonstrating undefined behaviour * Fix UB Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
1 parent bbc24b2 commit cbdeda8

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix undefined behaviour in ``_testcapimodule.c``.

Modules/_testcapimodule.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4918,8 +4918,10 @@ meth_fastcall_keywords(PyObject* self, PyObject* const* args,
49184918
if (pyargs == NULL) {
49194919
return NULL;
49204920
}
4921+
assert(args != NULL || nargs == 0);
4922+
PyObject* const* args_offset = args == NULL ? NULL : args + nargs;
49214923
PyObject *pykwargs = PyObject_Vectorcall((PyObject*)&PyDict_Type,
4922-
args + nargs, 0, kwargs);
4924+
args_offset, 0, kwargs);
49234925
return Py_BuildValue("NNN", _null_to_none(self), pyargs, pykwargs);
49244926
}
49254927

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

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