You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varb1, b2 bytes.Bufferw1:=gzip.NewWriter(&b1)
w1.Header.Comment="Hello"w1.Close()
w2:=gzip.NewWriter(&b2)
w2.Close()
r1, _:=gzip.NewReader(&b1)
fmt.Println("Comment:", r1.Header.Comment) // Should be "Hello"r1.Reset(bytes.NewReader(b2.Bytes()))
fmt.Println("Comment:", r1.Header.Comment) // Should be "", but prints "Hello"r2, _:=gzip.NewReader(bytes.NewReader(b2.Bytes()))
fmt.Println("Comment:", r2.Header.Comment) // Should be ""
If the Reader previously decoded a gzip Reader.Header and Reset is used, the header from the previous use of gzip may leak into the next use of Reader.
We should properly clear the Reader.Header with Reset.
The text was updated successfully, but these errors were encountered:
Using
go1.6
Example code:
If the Reader previously decoded a gzip Reader.Header and Reset is used, the header from the previous use of gzip may leak into the next use of Reader.
We should properly clear the Reader.Header with Reset.
The text was updated successfully, but these errors were encountered: