Skip to content

gh-111178: fix UBSan failures in Modules/_winapi.c #129796

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 5 commits into from
Feb 24, 2025
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
Prev Previous commit
Next Next commit
Do Do not use _ + capital letter in new code as it is also UB.
  • Loading branch information
picnixz committed Feb 8, 2025
commit 72737d076ac4358ba60063a95c7599fff620040c
6 changes: 3 additions & 3 deletions Modules/_winapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ typedef struct {
Py_buffer write_buffer;
} OverlappedObject;

#define _OverlappedObject_CAST(op) ((OverlappedObject *)(op))
#define OverlappedObject_CAST(op) ((OverlappedObject *)(op))

/*
Note: tp_clear (overlapped_clear) is not implemented because it
Expand All @@ -154,7 +154,7 @@ quite complex and can fail (see: overlapped_dealloc).
static int
overlapped_traverse(PyObject *op, visitproc visit, void *arg)
{
OverlappedObject *self = _OverlappedObject_CAST(op);
OverlappedObject *self = OverlappedObject_CAST(op);
Py_VISIT(self->read_buffer);
Py_VISIT(self->write_buffer.obj);
Py_VISIT(Py_TYPE(self));
Expand All @@ -166,7 +166,7 @@ overlapped_dealloc(PyObject *op)
{
DWORD bytes;
int err = GetLastError();
OverlappedObject *self = _OverlappedObject_CAST(op);
OverlappedObject *self = OverlappedObject_CAST(op);

PyObject_GC_UnTrack(self);
if (self->pending) {
Expand Down
Loading