Skip to content

Commit

Permalink
fix #317, try parse as BigFloat if overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
taowen committed Nov 12, 2018
1 parent 05d041d commit d05f387
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
14 changes: 12 additions & 2 deletions iter_skip_strict.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,22 @@

package jsoniter

import "fmt"
import (
"fmt"
"io"
)

func (iter *Iterator) skipNumber() {
if !iter.trySkipNumber() {
iter.unreadByte()
iter.ReadFloat32()
if iter.Error != nil && iter.Error != io.EOF {
return
}
iter.ReadFloat64()
if iter.Error != nil && iter.Error != io.EOF {
iter.Error = nil
iter.ReadBigFloat()
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions value_tests/raw_message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ func init() {
unmarshalCases = append(unmarshalCases, unmarshalCase{
ptr: (*json.RawMessage)(nil),
input: `[1,2,3]`,
}, unmarshalCase{
ptr: (*json.RawMessage)(nil),
input: `1.122e+250`,
})
}

0 comments on commit d05f387

Please sign in to comment.