1
0
mirror of https://github.com/golang/go synced 2024-11-12 06:40:22 -07:00

fmt: fix caching bug in Scan

Black box test is too time-consuming, as the bug
does not appear until Scan has processed 2 GB of
input in total across multiple calls, so no test.

Thanks to Frederick Mayle for the diagnosis and fix.

Fixes #2809.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5611043
This commit is contained in:
Russ Cox 2012-01-31 18:38:33 -05:00
parent d3285f2a79
commit d7c04517a0

View File

@ -366,6 +366,7 @@ func newScanState(r io.Reader, nlIsSpace, nlIsEnd bool) (s *ss, old ssave) {
s.fieldLimit = hugeWid
s.maxWid = hugeWid
s.validSave = true
s.count = 0
return
}