3 // Copyright 2010 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
7 // Issue 1011. Removing either #1 or #3 avoided the crash at #2.
16 func readU16BE(b []byte) uint16 {
19 return uint16(b[0])<<8 + uint16(b[1]) // #1
20 n := uint16(b[0])<<8 + uint16(b[1])
24 func readStr(r io.Reader, b []byte) string {
29 io.ReadFull(r, b[0:n]) // #2
30 return string(b[0:n]) // #3
35 br := strings.NewReader("abcd")
36 readStr(br, make([]byte, 256))