8000 gh-111178: fix UBSan failures in `Modules/_interp*module.c` by picnixz · Pull Request #129779 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-111178: fix UBSan failures in Modules/_interp*module.c #129779

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Feb 17, 2025
Merged
Prev Previous commit
Do Do not use _ + capital letter in new code as it is also UB.
  • Loading branch information
picnixz committed Feb 8, 2025
commit 9c6f69c8c22e6b67c8a696dab7bad0907dbfc58e
6 changes: 3 additions & 3 deletions Modules/_interpretersmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ typedef struct {
int64_t interpid;
} XIBufferViewObject;

#define _XIBufferViewObject_CAST(op) ((XIBufferViewObject *)(op))
#define XIBufferViewObject_CAST(op) ((XIBufferViewObject *)(op))

static PyObject *
xibufferview_from_xid(PyTypeObject *cls, _PyXIData_t *data)
Expand All @@ -104,7 +104,7 @@ xibufferview_from_xid(PyTypeObject *cls, _PyXIData_t *data)
static void
xibufferview_dealloc(PyObject *op)
{
XIBufferViewObject *self = _XIBufferViewObject_CAST(op);
XIBufferViewObject *self = XIBufferViewObject_CAST(op);
PyInterpreterState *interp = _PyInterpreterState_LookUpID(self->interpid);
/* If the interpreter is no longer alive then we have problems,
since other objects may be using the buffer still. */
Expand All @@ -131,7 +131,7 @@ xibufferview_getbuf(PyObject *op, Py_buffer *view, int flags)
{
/* Only PyMemoryView_FromObject() should ever call this,
via _memoryview_from_xid() below. */
XIBufferViewObject *self = _XIBufferViewObject_CAST(op);
XIBufferViewObject *self = XIBufferViewObject_CAST(op);
*view = *self->view;
view->obj = op;
// XXX Should we leave it alone?
Expand Down
Loading
0