From f7279a603edee96fe7764d3de9c6ff8cf9970994 Mon Sep 17 00:00:00 2001 From: Tao Wen Date: Wed, 15 Nov 2017 23:34:21 +0800 Subject: [PATCH] fix out of range --- feature_iter_int.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/feature_iter_int.go b/feature_iter_int.go index 2809cb24..6137348c 100644 --- a/feature_iter_int.go +++ b/feature_iter_int.go @@ -114,7 +114,7 @@ func (iter *Iterator) ReadUint32() (ret uint32) { func (iter *Iterator) readUint32(c byte) (ret uint32) { 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") } }() @@ -230,7 +230,7 @@ func (iter *Iterator) ReadUint64() uint64 { func (iter *Iterator) readUint64(c byte) (ret uint64) { 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") } }()