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

fix: avoid nil pointer dereference in ShouldContain assertions #615

Merged
merged 1 commit into from
Feb 14, 2023
Merged

fix: avoid nil pointer dereference in ShouldContain assertions #615

merged 1 commit into from
Feb 14, 2023

Conversation

iamleot
Copy link
Contributor

@iamleot iamleot commented Jan 14, 2023

It is possible to trigger nil pointer dereference by calling ShouldContain assertions.

Possible minimal reproducer in venom:

testcases:
  - steps:
      - assertions:
          - result.systemoutjson ShouldContain value

This PR fixes that by avoiding unconditional calls to Kind() when ShouldContain() contains a nil pointer like in previous example and adds a test to double-check that.

Signed-off-by: Leonardo Taccari <[email protected]>
@iamleot iamleot marked this pull request as ready for review January 14, 2023 00:15
Copy link
Member

@fsamin fsamin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for your PR
LGTM

@yesnault yesnault merged commit 5ba659f into ovh:master Feb 14, 2023
@iamleot
Copy link
Contributor Author

iamleot commented Feb 14, 2023

Thank you!

ivan-velasco pushed a commit to socotra/venom that referenced this pull request Sep 20, 2023
Signed-off-by: Leonardo Taccari <[email protected]>
Signed-off-by: Ivan Velasco <[email protected]>
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.

3 participants