Skip to content

Commit 88a3f18

Browse files
miss-islingtonCAM-Gerlachmatthiasgoergens
authored
gh-96821: Fix undefined behaviour in _testcapimodule.c (GH-96915) (GH-96926)
* gh-96821: Assert for demonstrating undefined behaviour * Fix UB (cherry picked from commit cbdeda8) Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Matthias Görgens <matthias.goergens@gmail.com>
1 parent f4be544 commit 88a3f18

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
@@ -5475,8 +5475,10 @@ meth_fastcall_keywords(PyObject* self, PyObject* const* args,
54755475
if (pyargs == NULL) {
54765476
return NULL;
54775477
}
5478+
assert(args != NULL || nargs == 0);
5479+
PyObject* const* args_offset = args == NULL ? NULL : args + nargs;
54785480
PyObject *pykwargs = PyObject_Vectorcall((PyObject*)&PyDict_Type,
5479-
args + nargs, 0, kwargs);
5481+
args_offset, 0, kwargs);
54805482
return Py_BuildValue("NNN", _null_to_none(self), pyargs, pykwargs);
54815483
}
54825484

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