-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.release-blocker
Milestone
Description
CL 229864 added code to Name.String that looks like:
if len(n.ExtraNames) == 0 {
for _, atv := range n.Names {
...
n.ExtraNames = append(n.ExtraNames, atv)
}
}
ahead of the existing
return n.ToRDNSequence().String()
This code has a subtle bug: if n.ExtraNames has len 0 but non-zero cap, this loop scribbles over n.ExtraName's backing store. By convention, String methods don't mutate the receiver, but this one does.
The code should add
n.ExtraNames = nil // avoid writing on caller's slice backing store
just before the for loop.
A test of Name.String would also be good.
(I'm surprised this package has no tests at all.)
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.release-blocker