]> Cypherpunks repositories - gostls13.git/commit
bufio: don't loop generating empty tokens
authorRob Pike <r@golang.org>
Wed, 5 Nov 2014 22:57:46 +0000 (09:57 +1100)
committerRob Pike <r@golang.org>
Wed, 5 Nov 2014 22:57:46 +0000 (09:57 +1100)
commit590f5283762a6e80796c3ae2bde410319162cb45
tree3959f29536f143fde183b6cddc63c04731bc0082
parentbb4a358af3469a1dee0cb5bcae245865233aa9ea
bufio: don't loop generating empty tokens

The new rules for split functions mean that we are exposed
to the common bug of a function that loops forever at EOF.
Pick these off by shutting down the scanner if too many
consecutive empty tokens are delivered.

Fixes #9020.

LGTM=rsc, adg
R=golang-codereviews, rsc, adg, bradfitz
CC=golang-codereviews
https://golang.org/cl/169970043
src/bufio/scan.go
src/bufio/scan_test.go