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

[V0.10] Coverity fixes #3423

Draft
wants to merge 16 commits into
base: v0.10
Choose a base branch
from

Conversation

matt335672
Copy link
Member

@matt335672 matt335672 commented Feb 5, 2025

Backports of the following devel PRs:-

#3421
#3422
#3442

Draft for now, so a few more can be added. None of these look crucial at the moment.

@matt335672
Copy link
Member Author

2025-02-11: Needs rebasing - see #3427

Add additional check to prevent Coverity assuming the worst

(cherry picked from commit db32f9c)
1) file descriptors cannot be zero when not in use.

2) Coverity seems to have some problems with the loop(s) copying data
   from one socket to another, in that it assumes that eventually an
   integer overflow will occur. It's not obvious why this should be
   flagged, but this seems likely to be a false positive.

   This commit avoids the integer issue by using a simple pointer + count
   mechanism.

The socket copy code has been placed in a separate function - before it
was duplicated. Minor fixes have been made to error reporting around the
connection code.

(cherry picked from commit 1/3 2d29342)
(cherry picked from commit 2/3 c122e05)
(cherry picked from commit 3/3 e169733)
(cherry picked from commit eff8ba7)
(cherry picked from commit b7a94bd)
(cherry picked from commit f7543c2)
This Coverity issue was encountered in a private build, but does not
appear to be in the Github CI build. Coverity is suspecting a copy-paste
betweem these lines in sound.c:-

1838: xstream_copyin(s, &g_stream_inp->data[g_stream_inp->size - g_bytes_in_stream], i);
1844: xstream_copyin(s, &g_stream_inp->data[g_stream_inp->size - g_bytes_in_stream], g_bytes_in_stream);

An inspection of the code shows this to bre a false positive

(cherry picked from commit 6088ba3)
(cherry picked from commit cb90458)
(cherry picked from commit 8769481)
(cherry picked from commit f376196)
Coverity has generated a number of 'Data race condition' and 'Double
lock' false positives. A lot of these seem to be caused by the NULL
guard in tc_mutex_unlock() not being paired with a NULL guard in
tc_mutex_lock(). This PR adds a NULL guard to tc_mutex_lock().

It should be noted, that on Linux at least, passing NULL to
tc_mutex_lock() causes a segfault. We clearly aren't doing this at the
moment, or we'd know about it. A log message is generated if a NULL
call is made, rather than failing silently.

(cherry picked from commit 67fbccc)
The define X11_UNIX_SOCKET_DIRECTORY is back-ported from the
devel stream for this.

(cherry picked from commit 4a95185)
(cherry picked from commit a7ab8ec)
(cherry picked from commit 621920e)
Repeated constant WAVE_FORMAT_MULAW in conditional

(cherry picked from commit 8b44986)
(cherry picked from commit 2805572)
(cherry picked from commit f187d23)
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.

1 participant