-
Committer:
Dustin Lundquist
-
Date:
2018-01-23 19:35:29 UTC
-
Revision ID:
git-v1:b13e49f7d8b46106b7fc72c92ae6bc363dcf1dd2
Fix bug in buffer module
While running under strace noticed strange readv()/writev() calls:
readv(5, [{iov_base="\0\0\0"..., iov_len=4096},
{iov_base="\0\0\0"..., iov_len=0}], 2) = 4096
writev(6, [{iov_base="\0\0\0"..., iov_len=4096},
{iov_base="\0\0\0"..., iov_len=0}], 2) = 4096
A second entry would be setup in the iov when filling an empty buffer or
emptying a full buffer. This was due to edge case handling in
setup_read_iov() and setup_write_iov() in buffer module. Fixed this edge
case handling and added asserts to these functions to detect any similar
defects. It doesn't appear this bug manifested any problems since the
second zero length read or write appears to have been ignored.