-
Joe Tsai authored
Corrected several issues: * RFC1951 section 3.2.7 dictates that it is okay for the HDist tree to have a single code of zero bits. Furthermore, the behavior of the C zlib library permits empty trees even when there are more than one codes. * RFC1951 section 3.2.5 shows that HLit codes 286 and 287 are invalid. Thus, Go's implementation should choke on inputs using these codes. * RFC1951 section 3.2.5 and 3.2.7 are ambiguous about whether the number of HDist codes can be greater than 30. The C zlib library (which is the canonical reference implementation) performs this check here: https://github.com/madler/zlib/blob/62d6112a7981ad7c34f3b43cffdf00d4662a4f25/inflate.c#L906 In addition, a number of test cases were added to the unit tests that exercises these edge cases. The test cases listed in TestStreams will either fail or succeed in a manner matching the behaviour of the C zlib version. Given that the C zlib implementation is the reference for the world, Go's implementation should match C zlib behaviour. Fixes #11030 Change-Id: Ic24e4e40ce5832c7e1930249246e86d34bfedaa6 Reviewed-on: https://go-review.googlesource.com/11000Reviewed-by: Nigel Tao <nigeltao@golang.org>
b03129aa