forked from mirror/go-json
Fix error handling of decoding of slice type
This commit is contained in:
parent
6befcb123e
commit
721f830cef
1
codec.go
1
codec.go
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue