Skip to content

Commit

Permalink
fix index out of range panic
Browse files Browse the repository at this point in the history
Signed-off-by: AdamKorcz <adam@adalogics.com>
  • Loading branch information
AdamKorcz committed Jun 29, 2023
1 parent f0fbe40 commit bf588b6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions map.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ func (d *Decoder) decMap(flag int32) (interface{}, error) {
case tag == BC_MAP_UNTYPED:
m = make(map[interface{}]interface{})
d.appendRefs(m)
if d.len() == 0 {
return nil, perrors.Errorf("the buffer is empty")
}
for d.peekByte() != BC_END {
k, err = d.Decode()
if err != nil {
Expand Down

0 comments on commit bf588b6

Please sign in to comment.