Skip to content

Commit 03950e7

Browse files
authored
Merge pull request #349 from orisano/fix/#348
2 parents 47a26db + 8c27bb4 commit 03950e7

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

decode_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3878,3 +3878,14 @@ func Benchmark306(b *testing.B) {
38783878
}
38793879
})
38803880
}
3881+
3882+
func TestIssue348(t *testing.T) {
3883+
in := strings.Repeat("["+strings.Repeat(",1000", 500)[1:]+"]", 2)
3884+
dec := json.NewDecoder(strings.NewReader(in))
3885+
for dec.More() {
3886+
var foo interface{}
3887+
if err := dec.Decode(&foo); err != nil {
3888+
t.Error(err)
3889+
}
3890+
}
3891+
}

internal/decoder/stream.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func (s *Stream) statForRetry() ([]byte, int64, unsafe.Pointer) {
103103

104104
func (s *Stream) Reset() {
105105
s.reset()
106-
s.bufSize = initBufSize
106+
s.bufSize = int64(len(s.buf))
107107
}
108108

109109
func (s *Stream) More() bool {

0 commit comments

Comments
 (0)