Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle empty pointers to complex structs in metadata.Add #221

Merged
merged 3 commits into from
Mar 18, 2024

Conversation

DariaKunoichi
Copy link
Contributor

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() 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.

@DariaKunoichi DariaKunoichi merged commit b1f53d0 into next Mar 18, 2024
53 checks passed
@DariaKunoichi DariaKunoichi deleted the PLAT-11766-addstruct-nilptr branch March 18, 2024 15:09
@DariaKunoichi DariaKunoichi mentioned this pull request Mar 18, 2024
DariaKunoichi added a commit that referenced this pull request Mar 18, 2024
## 2.3.1 (2024-03-18)

### Bug fixes

* Handle empty pointers to complex structs in metadata.Add
  [#221](#221)
@DariaKunoichi DariaKunoichi mentioned this pull request Mar 18, 2024
DariaKunoichi added a commit that referenced this pull request Mar 18, 2024
## 2.3.1 (2024-03-18)

### Bug fixes

* Handle empty pointers to complex structs in metadata.Add
  [#221](#221)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants