• Joe Tsai's avatar
    archive/tar: avoid empty IO operations · 7246585f
    Joe Tsai authored
    The interfaces for io.Reader and io.Writer permit calling Read/Write
    with an empty buffer. However, this condition is often not well tested
    and can lead to bugs in various implementations of io.Reader and io.Writer.
    For example, see #22028 for buggy io.Reader in the bzip2 package.
    
    We reduce the likelihood of hitting these bugs by adjusting
    regFileReader.Read and regFileWriter.Write to avoid performing
    Read and Write calls when the buffer is known to be empty.
    
    Fixes #22029
    
    Change-Id: Ie4a26be53cf87bc4d2abd951fa005db5871cc75c
    Reviewed-on: https://go-review.googlesource.com/66111
    Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
    Reviewed-by: 's avatarGiovanni Bajo <rasky@develer.com>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    7246585f
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...