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

refactor: Make prune_gc_sanctions_list more obviously correct. #2658

Merged
merged 1 commit into from
Feb 9, 2024

Conversation

iphydf
Copy link
Member

@iphydf iphydf commented Feb 9, 2024

target_ext_pk is uninitialised before the loop, and is definitely initialised after the loop iff sanction isn't NULL. If it is NULL, then target_ext_pk is not read. This is verifiable, but not obvious. PVS Studio isn't smart enough to figure that out, so it complains. I consider it a valid complaint, and the new code is clearer: we now call the processing part of the function directly with initialised values instead of relying on that initialisation coinciding with sanctions nullity.


This change is Reviewable

@iphydf iphydf added this to the v0.2.19 milestone Feb 9, 2024
@iphydf iphydf marked this pull request as ready for review February 9, 2024 00:19
Copy link

codecov bot commented Feb 9, 2024

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

Comparison is base (3ba7a0d) 73.76% compared to head (f058103) 73.77%.

Files Patch % Lines
toxcore/group_chats.c 0.00% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2658      +/-   ##
==========================================
+ Coverage   73.76%   73.77%   +0.01%     
==========================================
  Files         148      148              
  Lines       30479    30476       -3     
==========================================
+ Hits        22484    22485       +1     
+ Misses       7995     7991       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@JFreegman JFreegman left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 1 approvals obtained

`target_ext_pk` is uninitialised before the loop, and is definitely
initialised after the loop *iff* `sanction` isn't NULL. If it is NULL,
then `target_ext_pk` is not read. This is verifiable, but not obvious.
PVS Studio isn't smart enough to figure that out, so it complains. I
consider it a valid complaint, and the new code is clearer: we now call
the processing part of the function directly with initialised values
instead of relying on that initialisation coinciding with `sanction`s
nullity.
@iphydf iphydf merged commit f058103 into TokTok:master Feb 9, 2024
60 of 61 checks passed
@iphydf iphydf deleted the restructure branch February 9, 2024 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants