I was Purifying my application and noticed an uninitialized memory read
in libevent.. The uninitialized memory read was coming from:
epoll_dispatch [epoll.c:225]
event_debug(("%s: epoll_wait reports %d", __func__, res));
for (i = 0; i < res; i++) {
--> int what = events[i].events;
struct event *evread = NULL, *evwrite = NULL;
Which was allocated from:
epoll_init [epoll.c:144]
/* Initalize fields */
--> epollop->events = malloc(nfiles * sizeof(struct epoll_event));
if (epollop->events == NULL) {
free(epollop);
return (NULL);
}
epollop->nevents = nfiles;
I created a patch to convert the malloc to a calloc to ensure the memory
is initialized and the UMR goes away:
diff libevent-1.4.8-stable/epoll.c libevent-1.4.8-stable-mw/epoll.c
144c144
< epollop->events = malloc(nfiles * sizeof(struct epoll_event));
---
> epollop->events = calloc(nfiles, sizeof(struct epoll_event));
Hope you can incorporate this patch. Many thanks for the great job in
creating a super library.
Cheers,
Misk
This email and any files included with it may contain privileged,
proprietary and/or confidential information that is for the sole use
of the intended recipient(s). Any disclosure, copying, distribution,
posting, or use of the information contained in or attached to this
email is prohibited unless permitted by the sender. If you have
received this email in error, please immediately notify the sender
via return email, telephone, or fax and destroy this original transmission
and its included files without reading or saving it in any manner.
Thank you.
_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkeymail.org/mailman/listinfo/libevent-users