https://github.com/python/cpython/commit/c5e1131cfba5c6f083b149ea58a550db0f9e3a7a commit: c5e1131cfba5c6f083b149ea58a550db0f9e3a7a branch: 3.13 author: Miss Islington (bot) <[email protected]> committer: gpshead <[email protected]> date: 2025-01-20T21:05:52Z summary:
[3.13] gh-111178: fix UBSan failures in `Modules/_multiprocessing/semaphore.c` (GH-129084) (#129100) 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 4de4ee6c78fbd1..8c6a4a279205d3 100644 --- a/Modules/_multiprocessing/semaphore.c +++ b/Modules/_multiprocessing/semaphore.c @@ -27,6 +27,8 @@ typedef struct { char *name; } SemLockObject; +#define _SemLockObject_CAST(op) ((SemLockObject *)(op)) + /*[python input] class SEM_HANDLE_converter(CConverter): type = "SEM_HANDLE" @@ -575,8 +577,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) @@ -717,7 +720,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]
