]> Cypherpunks repositories - gostls13.git/commitdiff
fmt: fix caching bug in Scan
authorRuss Cox <rsc@golang.org>
Tue, 31 Jan 2012 23:38:33 +0000 (18:38 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 31 Jan 2012 23:38:33 +0000 (18:38 -0500)
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

src/pkg/fmt/scan.go

index 281525112e14bea7c6fa0cee6dfd95f884fb92d3..36c6aebad0e12f244a7b89384d579e87bbd5d9c4 100644 (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
 }