diff options
author | Joe Tsai <joetsai@digital-static.net> | 2016-08-30 16:08:06 -0700 |
---|---|---|
committer | Joe Tsai <thebrokentoaster@gmail.com> | 2016-08-31 01:12:02 +0000 |
commit | d3092464624f1f0ad29fa0ac4c4069fdd0697155 (patch) | |
tree | c155e1fedfc3247cf0436604686ea6861107e34e /src/compress/gzip/gunzip_test.go | |
parent | 6ebacf18a5769d071f467fae455a142a964a43da (diff) | |
download | go-d3092464624f1f0ad29fa0ac4c4069fdd0697155.tar.gz go-d3092464624f1f0ad29fa0ac4c4069fdd0697155.zip |
compress/flate: always return uncompressed data in the event of error
In the event of an unexpected error, we should always flush available
decompressed data to the user.
Fixes #16924
Change-Id: I0bc0824c3201f3149e84e6a26e3dbcba72a1aae5
Reviewed-on: https://go-review.googlesource.com/28216
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/compress/gzip/gunzip_test.go')
-rw-r--r-- | src/compress/gzip/gunzip_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/compress/gzip/gunzip_test.go b/src/compress/gzip/gunzip_test.go index fdce91989a..fdea0c5d5f 100644 --- a/src/compress/gzip/gunzip_test.go +++ b/src/compress/gzip/gunzip_test.go @@ -339,6 +339,26 @@ var gunzipTests = []gunzipTest{ }, nil, }, + { + "", + "truncated gzip file amid raw-block", + "hello", + []byte{ + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, + 0x00, 0x0c, 0x00, 0xf3, 0xff, 0x68, 0x65, 0x6c, 0x6c, 0x6f, + }, + io.ErrUnexpectedEOF, + }, + { + "", + "truncated gzip file amid fixed-block", + "He", + []byte{ + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, + 0xf2, 0x48, 0xcd, + }, + io.ErrUnexpectedEOF, + }, } func TestDecompressor(t *testing.T) { |