Appending to the enc buffer provided by the caller causes problems when the buffer has extra capacity beyond its len, but the data in that extra capacity is owned by other code. This situation can arise due to in-place decoders, as proposed for the TLS-syntax in https://github.com/cisco/go-tls-syntax/pull/1. (Go does not have a way to shrink a slices capacity, unfortunately.)
Appending to the
enc
buffer provided by the caller causes problems when the buffer has extra capacity beyond its len, but the data in that extra capacity is owned by other code. This situation can arise due to in-place decoders, as proposed for the TLS-syntax in https://github.com/cisco/go-tls-syntax/pull/1. (Go does not have a way to shrink a slices capacity, unfortunately.)