message-size-increase #3

Merged
sashakoshka merged 227 commits from message-size-increase into main 2025-09-07 19:27:38 -06:00
3 changed files with 20 additions and 4 deletions
Showing only changes of commit 04c352fad6 - Show all commits

View File

@ -171,10 +171,12 @@ func decodeAnyOrError(decoder *Decoder, destination reflect.Value, tag Tag) (n i
if length > uint64(MaxStructureLength) { if length > uint64(MaxStructureLength) {
return 0, ErrTooLong return 0, ErrTooLong
} }
lengthCast, err := Uint64ToIntSafe(length)
if err != nil { return n, err }
oneTag, nn, err := decoder.ReadTag() oneTag, nn, err := decoder.ReadTag()
n += nn; if err != nil { return n, err } n += nn; if err != nil { return n, err }
if destination.Cap() < int(length) { if destination.Cap() < lengthCast {
destination.Grow(int(length) - destination.Cap()) destination.Grow(lengthCast - destination.Cap())
} }
// skip the rest of the array if the one tag doesn't // skip the rest of the array if the one tag doesn't
// match up with the destination // match up with the destination