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: Fix some false positive from PVS Studio. #2657

Merged
merged 1 commit into from
Feb 9, 2024

Conversation

iphydf
Copy link
Member

@iphydf iphydf commented Feb 9, 2024

It correctly warns about potentially dereferencing NULL chat in a log statement. However, chat can semantically never be NULL in that call, and it's just a defensive check. Still good to fix for clarity.


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:15
Copy link
Member

@nurupo nurupo left a comment

Choose a reason for hiding this comment

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

Yep, dereferencing a pointer first and then checking if it's null a line below is indeed eyebrow rising, good on it to complain.

Copy link

codecov bot commented Feb 9, 2024

Codecov Report

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

Comparison is base (7c44379) 73.71% compared to head (9fe18b1) 73.75%.

Files Patch % Lines
toxcore/group_chats.c 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2657      +/-   ##
==========================================
+ Coverage   73.71%   73.75%   +0.03%     
==========================================
  Files         148      148              
  Lines       30481    30481              
==========================================
+ Hits        22469    22480      +11     
+ Misses       8012     8001      -11     

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

It correctly warns about potentially dereferencing NULL chat in a log
statement. However, chat can semantically never be NULL in that call,
and it's just a defensive check. Still good to fix for clarity.
@iphydf iphydf merged commit 9fe18b1 into TokTok:master Feb 9, 2024
58 of 59 checks passed
@iphydf iphydf deleted the null-deref branch February 9, 2024 00:52
This pull request was closed.
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.

2 participants