event-mask-validation-for-ModifyWaitEvent.patch
application/x-patch
Filename: event-mask-validation-for-ModifyWaitEvent.patch
Type: application/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/backend/storage/ipc/waiteventset.c | 6 | 1 |
diff --git a/src/backend/storage/ipc/waiteventset.c b/src/backend/storage/ipc/waiteventset.c index 0f228e1e7b8..098cff06a5d 100644 --- a/src/backend/storage/ipc/waiteventset.c +++ b/src/backend/storage/ipc/waiteventset.c @@ -695,7 +695,12 @@ ModifyWaitEvent(WaitEventSet *set, int pos, uint32 events, Latch *latch) if (event->events & WL_LATCH_SET && events != event->events) elog(ERROR, "cannot modify latch event"); - /* FIXME: validate event mask */ + /* Validate event mask */ + if ((events & WL_SOCKET_MASK) && event->fd == PGINVALID_SOCKET) + elog(ERROR, "cannot wait on socket event without a socket"); + if ((events & WL_LATCH_SET) && !(event->events & WL_LATCH_SET)) + elog(ERROR, "cannot modify non-latch event to wait on latch"); + event->events = events; if (events == WL_LATCH_SET)