tape: Fix negative slice length
This commit is contained in:
parent
c8a2f03ca1
commit
5989a82bee
@ -129,7 +129,7 @@ func decodeAny(decoder *Decoder, destination reflect.Value, tag Tag) (n int, err
|
|||||||
return n, errWrongDestinationType("slice")
|
return n, errWrongDestinationType("slice")
|
||||||
}
|
}
|
||||||
if destination.Cap() < int(length) {
|
if destination.Cap() < int(length) {
|
||||||
destination.Grow(destination.Cap() - int(length))
|
destination.Grow(int(length) - destination.Cap())
|
||||||
}
|
}
|
||||||
destination.SetLen(int(length))
|
destination.SetLen(int(length))
|
||||||
for index := range length {
|
for index := range length {
|
||||||
|
Loading…
Reference in New Issue
Block a user