When we pass a pointer to complex interface (that in Sanitizer gets caught in type switch-case) we don't check if the pointer is nil.
Type specific switch-case tried to check for interface function String() for fmt.Stringer interface on the nil pointer leading to a panic.
Changeset
Moved check for nil pointers and interfaces before any other type matching is done.
In metadata.AddStruct used an actual sanitized value to pass into metadata.Add.
Testing
New tests for adding pointers with Stringer interface to metadata - either nil ptr or normal.
Goal
When we pass a pointer to complex interface (that in Sanitizer gets caught in type switch-case) we don't check if the pointer is nil. Type specific switch-case tried to check for interface function
String()
forfmt.Stringer
interface on the nil pointer leading to a panic.Changeset
Moved check for nil pointers and interfaces before any other type matching is done. In
metadata.AddStruct
used an actual sanitized value to pass intometadata.Add
.Testing
New tests for adding pointers with Stringer interface to metadata - either nil ptr or normal.