wininet: don't evaluate netconn_get_avail_data() twice in netconn_read()

Dan Kegel dank at kegel.com
Sat Jul 7 19:34:52 CDT 2012


Using netconn_get_avail_data() in min() is funky, don't do it.

min() is a macro which evaluates its right hand argument twice,
which is not only extra work, it also might return different values
on the two calls, leading to min() sometimes returning a
larger value than either of its 'two' inputs.

Also added an assertion that makes the problem obvious.

Thanks to Sami Aario for spotting the overrun.

Fixes http://bugs.winehq.org/show_bug.cgi?id=27090 and
probably http://bugs.winehq.org/show_bug.cgi?id=22856
-------------- next part --------------
A non-text attachment was scrubbed...
Name: refill.patch
Type: application/octet-stream
Size: 1655 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20120707/baca424b/attachment.obj>


More information about the wine-patches mailing list