mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
[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 5ed5572cac
)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
parent
2077082463
commit
c5e1131cfb
1 changed files with 5 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue