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 nil pointer dereference on Placement #5996

Merged
merged 3 commits into from
Oct 14, 2024

Conversation

Jarema
Copy link
Member

@Jarema Jarema commented Oct 13, 2024

The check for empty object exposed a lack of check for *Placement before accessing its fields. This commit properly fixes it.

Signed-off-by: Tomasz Pietrek [email protected]

The check for empty object exposed a lack of check for `*Placement`
before accessing its fields. This commit properly fixes it.

Signed-off-by: Tomasz Pietrek <[email protected]>
@Jarema Jarema requested a review from a team as a code owner October 13, 2024 13:10
@wallyqs
Copy link
Member

wallyqs commented Oct 13, 2024

think we need coverage of sending empty objects on the other endpoints that might have been relying on filtering out empty fields.

also for this one need a test of sending unitialized placement like {“placement”: null}

@Jarema
Copy link
Member Author

Jarema commented Oct 13, 2024

Will add a test. Did a brief check of others usages and it seems fine, but will test to be sure.

Signed-off-by: Tomasz Pietrek <[email protected]>
@Jarema
Copy link
Member Author

Jarema commented Oct 14, 2024

Added a test, but I wonder if it makes sense to have it - empty object test achieves the same as JSApiLeaderStepdownRequest{Placement: nil}.

Signed-off-by: Tomasz Pietrek <[email protected]>
@Jarema
Copy link
Member Author

Jarema commented Oct 14, 2024

Checked other endpoints that are using new function. We do not have pointers in them.

@wallyqs
Copy link
Member

wallyqs commented Oct 14, 2024

@Jarema you're right in this case placement has omitempty so result would be the same

Copy link
Member

@wallyqs wallyqs left a comment

Choose a reason for hiding this comment

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

LGTM

@derekcollison derekcollison merged commit f4f0e89 into main Oct 14, 2024
5 checks passed
@derekcollison derekcollison deleted the fix-nil-pointer-dereference branch October 14, 2024 17:01
neilalexander pushed a commit that referenced this pull request Oct 15, 2024
The check for empty object exposed a lack of check for `*Placement`
before accessing its fields. This commit properly fixes it.

Signed-off-by: Tomasz Pietrek <[email protected]>

---------

Signed-off-by: Tomasz Pietrek <[email protected]>
neilalexander added a commit that referenced this pull request Oct 16, 2024
Includes:

- #5986
- #5995 
- #6000
- #5996
- #6002
- #6003
- #6007

Signed-off-by: Neil Twigg <[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