don't modify argument slices
There were a couple spots where argument slices weren't being copied before `append` was called, which could possibly modify the caller's slice data.
This commit is contained in:
parent
55469cd416
commit
b5de50c0a2
|
@ -174,6 +174,9 @@ func (r *DiffFieldReader) readPrimitive(
|
|||
|
||||
func (r *DiffFieldReader) readSet(
|
||||
address []string, schema *Schema) (FieldReadResult, error) {
|
||||
// copy address to ensure we don't modify the argument
|
||||
address = append([]string(nil), address...)
|
||||
|
||||
prefix := strings.Join(address, ".") + "."
|
||||
|
||||
// Create the set that will be our result
|
||||
|
|
|
@ -98,6 +98,9 @@ func (r *MapFieldReader) readPrimitive(
|
|||
|
||||
func (r *MapFieldReader) readSet(
|
||||
address []string, schema *Schema) (FieldReadResult, error) {
|
||||
// copy address to ensure we don't modify the argument
|
||||
address = append([]string(nil), address...)
|
||||
|
||||
// Get the number of elements in the list
|
||||
countRaw, err := r.readPrimitive(
|
||||
append(address, "#"), &Schema{Type: TypeInt})
|
||||
|
|
Loading…
Reference in New Issue