Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix UBSan failures for DirEntry
  • Loading branch information
picnixz committed Feb 6, 2025
commit f53e72ac5e38fb3eb70b47a123194bef03d3ef6d
8 changes: 6 additions & 2 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -15523,9 +15523,12 @@ typedef struct {
#endif
} DirEntry;

#define DirEntry_CAST(op) ((DirEntry *)(op))

static void
DirEntry_dealloc(DirEntry *entry)
DirEntry_dealloc(PyObject *op)
{
DirEntry *entry = DirEntry_CAST(op);
PyTypeObject *tp = Py_TYPE(entry);
Py_XDECREF(entry->name);
Py_XDECREF(entry->path);
Expand Down Expand Up @@ -15854,8 +15857,9 @@ os_DirEntry_inode_impl(DirEntry *self)
}

static PyObject *
DirEntry_repr(DirEntry *self)
DirEntry_repr(PyObject *op)
{
DirEntry *self = DirEntry_CAST(op);
return PyUnicode_FromFormat("<DirEntry %R>", self->name);
}

Expand Down