-
Notifications
You must be signed in to change notification settings - Fork 305
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
2023.8-3 coverity scan #3265
2023.8-3 coverity scan #3265
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems more reasonable, but now there are lots of failing tests. For instance, one of the tests fails like this:
++ ostree --repo=ostree-srv/gnomerepo static-delta generate main
modified: 1
new reachable: metadata=3 content regular=2 symlink=0
rollsum for 0/1 modified
processing bsdiff: [0/1]
fallback for c5efd04e28fd1f9ae16cd119bb79766cdf042b3f1ef89a282f0b3ca68c062b8c (21.9 MB)
part 1 n:3 compressed:585 uncompressed:524
uncompressed=524 compressed=585 loose=484
rollsum=0 objects, 0 bytes
bsdiff=1 objects
++ ostree --repo=ostree-srv/gnomerepo summary -u
++ cd /test-tmp/tap-test.KzJhuj
++ ostree --repo=repo pull origin main
/__w/ostree/ostree/ci-build/../tests/pull-test.sh: line 573: 37143 Segmentation fault (core dumped) ${CMD_PREFIX} ostree --repo=repo pull origin main
If I had to guess, this is from the change in ostree_repo_static_delta_execute_offline_with_signature
. Possibly g_path_get_dirname
has slightly different semantics than dirname
.
09d4fd5
to
1b2e9af
Compare
42366e6
to
5b79d5a
Compare
Coverity points out that we have a memory leak from `g_strdup(name)`. `insert_child_mtree()` takes a const char * and duplicates it. `name` can be passed directly to `insert_child_mtree()`.
Coverity points out that we are passing an unterminated string to sprintf(). Fix by using snprintf() which stores the content as a C string.
Coverity points out that we have a memory leak from `g_strdup(dir_or_file_path)`. Make the duplication of the string a temporary variable that is freed using `g_autofree`.
Coverity points out that ""/sysroot.tmp/etc"" could be a copy-paste error. This is mistake from coverity, but to supress the warning, we create a global var, tmp_sysroot_etc, which replaces all instances of TMP_SYSROOT "/etc".
5b79d5a
to
e99693c
Compare
Change reverted since it made the code more complex. This change request is no longer applicable.
tree: Fix
name
memory leakCoverity points out that we have a memory leak from
g_strdup(name)
.insert_child_mtree()
takes a const char * and duplicates it.name
can be passed directly toinsert_child_mtree()
.commit: Null terminate
target_buf
varCoverity points out that we are passing an unterminated string to
sprintf().
repo: Fix
dir_or_file_path
memory leakCoverity points out that we have a memory leak from
g_strdup(dir_or_file_path)
. We useg_path_get_dirname()
whichmodifies the string in place, to which coverity should understand.
prepare: Create global var for tmp_sysroot_etc
Coverity points out that ""/sysroot.tmp/etc"" could be a copy-paste
error. This is mistake from coverity, but to supress the warning,
we create a global var, tmp_sysroot_etc, which replaces all
instances of TMP_SYSROOT "/etc".