Fix error handling of decoding of slice type

This commit is contained in:
Masaaki Goshima 2021-02-09 22:19:13 +09:00
parent 6befcb123e
commit 721f830cef
2 changed files with 5 additions and 1 deletions

View File

@ -71,7 +71,6 @@ func setupCodec() error {
cachedOpcodeSets = make([]*opcodeSet, addrRange)
existsCachedOpcodeSets = true
cachedDecoder = make([]decoder, addrRange)
existsCachedDecoder = true
baseTypeAddr = min
maxTypeAddr = max
return nil

View File

@ -248,7 +248,12 @@ func (d *sliceDecoder) decode(buf []byte, cursor int64, p unsafe.Pointer) (int64
}
cursor++
}
case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
return 0, d.errNumber([]byte{buf[cursor]}, cursor)
default:
goto ERROR
}
}
ERROR:
return 0, errUnexpectedEndOfJSON("slice", cursor)
}