forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf1821b5
committed
Fix WaitEventSetWait() buffer overrun.
The WAIT_USE_EPOLL and WAIT_USE_KQUEUE implementations ofWaitEventSetWaitBlock() confused the size of their internal buffer withthe size of the caller's output buffer, and could ask the kernel for toomany events. In fact the set of events retrieved from the kernel needsto be able to fit in both buffers, so take the smaller of the two.The WAIT_USE_POLL and WAIT_USE WIN32 implementations didn't have thisconfusion.This probably didn't come up before because we always used the samenumber in both places, but commit7389aad calculates a dynamic size atconstruction time, while using MAXLISTEN for its output event buffer onthe stack. That seems like a reasonable thing to want to do, soconsider this to be a pre-existing bug worth fixing.As discovered by valgrind on skink.Back-patch to all supported releases for epoll, and to release 13 forthe kqueue part, which copied the incorrect epoll code.Reviewed-by: Andres Freund <andres@anarazel.de>Discussion:https://postgr.es/m/901504.1673504836%40sss.pgh.pa.us1 parent3161ae8 commitf1821b5
1 file changed
+3
-2
lines changedLines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1525 | 1525 |
| |
1526 | 1526 |
| |
1527 | 1527 |
| |
1528 |
| - | |
| 1528 | + | |
1529 | 1529 |
| |
1530 | 1530 |
| |
1531 | 1531 |
| |
| |||
1685 | 1685 |
| |
1686 | 1686 |
| |
1687 | 1687 |
| |
1688 |
| - | |
| 1688 | + | |
| 1689 | + | |
1689 | 1690 |
| |
1690 | 1691 |
| |
1691 | 1692 |
| |
|
0 commit comments
Comments
(0)