embedthis/mpr-4 — pull request #1 by jchampio (2012-05-04 19:41:20+00:00)
Title: Ensure growFds grows the handler map enough

On some platforms using select, we've seen that socket file descriptors start out as very large numbers (in the hundreds). This is strange behavior, but technically allowed, and the current implementation of growFds does not actually check that it has grown "enough". This means that other code might access the handler map out-of-bounds.

mprSelect.c's version of growFds now takes the current file descriptor as an argument in order to guarantee that when it returns, the handler map will be big enough to hold it.

*Note: the mprPoll.c implementation of growFds also does not perform a check to ensure proper growth. I'm not familiar with the poll() architecture, and we don't have any such targets to test on, so I'm not comfortable making changes myself. But it would probably be a good idea to look at that code as well.*