Skip to content

Commit

Permalink
Merge branch 'main' into optimize/ftoa
Browse files Browse the repository at this point in the history
  • Loading branch information
AsterDY committed Sep 8, 2022
2 parents e7b645c + a48cad8 commit 734b06e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion decoder/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ read_more:

func (self StreamDecoder) repeatable(err error) bool {
if ee, ok := err.(SyntaxError); ok &&
(ee.Code == types.ERR_EOF || (ee.Code == types.ERR_INVALID_CHAR && self.i == len(self.s)-1)) {
(ee.Code == types.ERR_EOF || (ee.Code == types.ERR_INVALID_CHAR && self.i >= len(self.s)-1)) {
return true
}
return false
Expand Down
16 changes: 16 additions & 0 deletions issue_test/issue293_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,20 @@ func TestIssue293(t *testing.T) {
if err != nil {
t.Fatal(err)
}
}

func TestIssue293Sign(t *testing.T) {
left := `{"a":`
var data = left+strings.Repeat(" ", 4096 - len(left)-1) + "-33.0}"
sd := decoder.NewStreamDecoder(strings.NewReader(data))
var v = struct{
A json.RawMessage
}{}
err := sd.Decode(&v)
if err != nil {
if e, ok := err.(decoder.SyntaxError); ok {
t.Fatal(e.Description())
}
t.Fatal(err)
}
}

0 comments on commit 734b06e

Please sign in to comment.