encoding/asn1: When slicing bytes specify capacity or allocate new slice #14882
Labels
Documentation
Issues describing a change to documentation.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
parseField
should use triple slice assignments ([x:y:z]
) to specify the capacity of slices when dealing withRawContent
andRawValue
fields. Defining the capacity of these slices will prevent other fields in a struct that reference the same underlying byte slice from inadvertently being mutated by operations that attempt to expand the slice (i.e.append
).go version
)?go1.6
go env
)?Ubuntu 15.10 amd64
Basic example: https://play.golang.org/p/ibPZYcKNs5
In above example
b.Raw
shouldn't be affected by usingappend
The last three bytes of
b.Raw
are overwritten.The text was updated successfully, but these errors were encountered: