https://github.com/python/cpython/commit/9b335cc8104dd83a5a1343dc649d1f3606682098 commit: 9b335cc8104dd83a5a1343dc649d1f3606682098 branch: 3.12 author: Miss Islington (bot) <[email protected]> committer: gpshead <[email protected]> date: 2025-01-20T21:00:09Z summary:
[3.12] gh-111178: fix UBSan failures in `Modules/_multiprocessing/semaphore.c` (GH-129084) (#129101) gh-111178: fix UBSan failures in `Modules/_multiprocessing/semaphore.c` (GH-129084) fix UBSan failures for `SemLockObject` (cherry picked from commit 5ed5572cac7ef204767ddf8e8888e15672ba558e) Co-authored-by: Bénédikt Tran <[email protected]> files: M Modules/_multiprocessing/semaphore.c diff --git a/Modules/_multiprocessing/semaphore.c b/Modules/_multiprocessing/semaphore.c index c7df82dfe2d0cc..bc718e273a8721 100644 --- a/Modules/_multiprocessing/semaphore.c +++ b/Modules/_multiprocessing/semaphore.c @@ -23,6 +23,8 @@ typedef struct { char *name; } SemLockObject; +#define _SemLockObject_CAST(op) ((SemLockObject *)(op)) + /*[python input] class SEM_HANDLE_converter(CConverter): type = "SEM_HANDLE" @@ -567,8 +569,9 @@ _multiprocessing_SemLock__rebuild_impl(PyTypeObject *type, SEM_HANDLE handle, } static void -semlock_dealloc(SemLockObject* self) +semlock_dealloc(PyObject *op) { + SemLockObject *self = _SemLockObject_CAST(op); PyTypeObject *tp = Py_TYPE(self); PyObject_GC_UnTrack(self); if (self->handle != SEM_FAILED) @@ -706,7 +709,7 @@ _multiprocessing_SemLock___exit___impl(SemLockObject *self, } static int -semlock_traverse(SemLockObject *s, visitproc visit, void *arg) +semlock_traverse(PyObject *s, visitproc visit, void *arg) { Py_VISIT(Py_TYPE(s)); return 0; _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: [email protected]
