mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-11 21:34:53 -04:00
Fix epoll fencepost error. Patch most recently from Adam Langley, though I think I have seen others post this before.
svn:r1323
This commit is contained in:
parent
0ec290be04
commit
b0d88e680b
@ -2,6 +2,7 @@ Changes in 1.4.12-stable:
|
|||||||
o Try to contain degree of failure when running on a win32 version so heavily firewalled that we can't fake a socketpair.
|
o Try to contain degree of failure when running on a win32 version so heavily firewalled that we can't fake a socketpair.
|
||||||
o Fix an obscure timing-dependent, allocator-dependent crash in the evdns code.
|
o Fix an obscure timing-dependent, allocator-dependent crash in the evdns code.
|
||||||
o Use __VA_ARGS__ syntax for varargs macros in event_rpcgen when compiler is not GCC.
|
o Use __VA_ARGS__ syntax for varargs macros in event_rpcgen when compiler is not GCC.
|
||||||
|
o Fix another pair of fencepost bugs in epoll.c. [Patch from Adam Langley.]
|
||||||
|
|
||||||
Changes in 1.4.11-stable:
|
Changes in 1.4.11-stable:
|
||||||
o Fix a bug when removing a timeout from the heap. [Patch from Marko Kreen]
|
o Fix a bug when removing a timeout from the heap. [Patch from Marko Kreen]
|
||||||
|
4
epoll.c
4
epoll.c
@ -171,7 +171,7 @@ epoll_recalc(struct event_base *base, void *arg, int max)
|
|||||||
int nfds;
|
int nfds;
|
||||||
|
|
||||||
nfds = epollop->nfds;
|
nfds = epollop->nfds;
|
||||||
while (nfds < max)
|
while (nfds <= max)
|
||||||
nfds <<= 1;
|
nfds <<= 1;
|
||||||
|
|
||||||
fds = realloc(epollop->fds, nfds * sizeof(struct evepoll));
|
fds = realloc(epollop->fds, nfds * sizeof(struct evepoll));
|
||||||
@ -226,7 +226,7 @@ epoll_dispatch(struct event_base *base, void *arg, struct timeval *tv)
|
|||||||
struct event *evread = NULL, *evwrite = NULL;
|
struct event *evread = NULL, *evwrite = NULL;
|
||||||
int fd = events[i].data.fd;
|
int fd = events[i].data.fd;
|
||||||
|
|
||||||
if (fd < 0 && fd >= epollop->nfds)
|
if (fd < 0 || fd >= epollop->nfds)
|
||||||
continue;
|
continue;
|
||||||
evep = &epollop->fds[fd];
|
evep = &epollop->fds[fd];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user