mirror of
https://github.com/json-iterator/go.git
synced 2025-06-06 22:36:25 +02:00
fix out of range
This commit is contained in:
parent
9f088cbcc4
commit
f7279a603e
@ -114,7 +114,7 @@ func (iter *Iterator) ReadUint32() (ret uint32) {
|
|||||||
|
|
||||||
func (iter *Iterator) readUint32(c byte) (ret uint32) {
|
func (iter *Iterator) readUint32(c byte) (ret uint32) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if iter.buf[iter.head] == '.' {
|
if iter.head < len(iter.buf) && iter.buf[iter.head] == '.' {
|
||||||
iter.ReportError("readUint32", "can not decode float as int")
|
iter.ReportError("readUint32", "can not decode float as int")
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@ -230,7 +230,7 @@ func (iter *Iterator) ReadUint64() uint64 {
|
|||||||
|
|
||||||
func (iter *Iterator) readUint64(c byte) (ret uint64) {
|
func (iter *Iterator) readUint64(c byte) (ret uint64) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if iter.buf[iter.head] == '.' {
|
if iter.head < len(iter.buf) && iter.buf[iter.head] == '.' {
|
||||||
iter.ReportError("readUint64", "can not decode float as int")
|
iter.ReportError("readUint64", "can not decode float as int")
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user