From 414fc2592bb9808340cad8b0373ed5a43bce88fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dikt=20Tran?= <10796600+picnixz@users.noreply.github.com> Date: Sun, 15 Jun 2025 21:00:58 +0200 Subject: [PATCH] gh-111178: fix UBSan failures for `RemoteUnwinderObject` (GH-135539) (cherry picked from commit 54e29ea4eb7b54c888fd5764eef2215535e4d862) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> --- Modules/_remote_debugging_module.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Modules/_remote_debugging_module.c b/Modules/_remote_debugging_module.c index 86bf19e81c629d..ad14f5be03b5a2 100644 --- a/Modules/_remote_debugging_module.c +++ b/Modules/_remote_debugging_module.c @@ -212,6 +212,8 @@ typedef struct { #endif } RemoteUnwinderObject; +#define RemoteUnwinder_CAST(op) ((RemoteUnwinderObject *)(op)) + typedef struct { int lineno; @@ -2899,8 +2901,9 @@ static PyMethodDef RemoteUnwinder_methods[] = { }; static void -RemoteUnwinder_dealloc(RemoteUnwinderObject *self) +RemoteUnwinder_dealloc(PyObject *op) { + RemoteUnwinderObject *self = RemoteUnwinder_CAST(op); PyTypeObject *tp = Py_TYPE(self); if (self->code_object_cache) { _Py_hashtable_destroy(self->code_object_cache);