Error: COMPILER_WARNING (CWE-252): [#def1] createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/dumper_thread.c: scope_hint: In function ‘get_checksum’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/dumper_thread.c:409:9: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ # 409 | write(fd, checksum, strlen(checksum)); # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 407| } # 408| # 409|-> write(fd, checksum, strlen(checksum)); # 410| close(fd); # 411| if (!cr_move_recursive(template, cachefn, &tmp_err)) { Error: GCC_ANALYZER_WARNING (CWE-457): [#def2] createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/dumper_thread.c: scope_hint: In function ‘cr_dumper_thread’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/dumper_thread.c:606:23: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘stat_buf.st_mtim.tv_sec’ /usr/include/glib-2.0/glib/gstring.h:37: included_from: Included from here. /usr/include/glib-2.0/glib/giochannel.h:36: included_from: Included from here. /usr/include/glib-2.0/glib.h:56: included_from: Included from here. createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/dumper_thread.c:20: included_from: Included from here. /usr/include/glib-2.0/glib/gstrfuncs.h:324:38: note: in definition of macro ‘g_strdup’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/dumper_thread.c:548:21: note: in expansion of macro ‘g_strdup’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/dumper_thread.c: scope_hint: In function ‘cr_dumper_thread’ /usr/include/glib-2.0/glib.h:64: included_from: Included from here. createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/dumper_thread.c:602:13: note: in expansion of macro ‘g_debug’ /usr/include/bits/stat.h:25: included_from: Included from here. /usr/include/sys/stat.h:101: included_from: Included from here. /usr/include/glib-2.0/glib/gstdio.h:27: included_from: Included from here. createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/dumper_thread.c:21: included_from: Included from here. # 604| if (udata->skip_stat) { # 605| old_used = TRUE; # 606|-> } else if (stat_buf.st_mtime == md->time_file # 607| && stat_buf.st_size == md->size_package # 608| && !strcmp(udata->checksum_type_str, md->checksum_type)) Error: GCC_ANALYZER_WARNING (CWE-775): [#def3] createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/misc.c: scope_hint: In function ‘cr_copy_file’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/misc.c:422:17: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(src, "rb")’ # 420| # 421| // Open src file # 422|-> if ((orig = fopen(src, "rb")) == NULL) { # 423| const gchar * fopen_error = g_strerror(errno); # 424| g_debug("%s: Cannot open source file %s (%s)", __func__, src, Error: GCC_ANALYZER_WARNING (CWE-401): [#def4] createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/misc.c:422:17: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(src, "rb")’ # 420| # 421| // Open src file # 422|-> if ((orig = fopen(src, "rb")) == NULL) { # 423| const gchar * fopen_error = g_strerror(errno); # 424| g_debug("%s: Cannot open source file %s (%s)", __func__, src, Error: GCC_ANALYZER_WARNING (CWE-775): [#def5] createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/misc.c:432:16: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(dst, "wb")’ # 430| # 431| // Open dst file # 432|-> if ((new = fopen(dst, "wb")) == NULL) { # 433| const gchar * fopen_error = g_strerror(errno); # 434| g_debug("%s: Cannot open destination file %s (%s)", __func__, dst, Error: GCC_ANALYZER_WARNING (CWE-401): [#def6] createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/misc.c:432:16: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(dst, "wb")’ # 430| # 431| // Open dst file # 432|-> if ((new = fopen(dst, "wb")) == NULL) { # 433| const gchar * fopen_error = g_strerror(errno); # 434| g_debug("%s: Cannot open destination file %s (%s)", __func__, dst, Error: CPPCHECK_WARNING (CWE-404): [#def7] createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/misc.c:438: error[resourceLeak]: Resource leak: orig # 436| g_set_error(err, ERR_DOMAIN, CRE_IO, # 437| "Cannot open file %s: %s", dst, fopen_error); # 438|-> return FALSE; # 439| } # 440| Error: GCC_ANALYZER_WARNING (CWE-775): [#def8] createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/misc.c: scope_hint: In function ‘cr_download’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/misc.c:748:12: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(dst, "wb")’ # 746| # 747| // Open dst file # 748|-> file = fopen(dst, "wb"); # 749| if (!file) { # 750| g_set_error(err, ERR_DOMAIN, CRE_IO, Error: GCC_ANALYZER_WARNING (CWE-401): [#def9] createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/misc.c:748:12: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(dst, "wb")’ # 746| # 747| // Open dst file # 748|-> file = fopen(dst, "wb"); # 749| if (!file) { # 750| g_set_error(err, ERR_DOMAIN, CRE_IO, Error: CPPCHECK_WARNING (CWE-404): [#def10] createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/misc.c:767: error[resourceLeak]: Resource leak: file # 765| "curl_easy_setopt failed(CURLOPT_ERRORBUFFER): %s", # 766| curl_easy_strerror(rcode)); # 767|-> return CRE_CURL; # 768| } # 769| Error: CPPCHECK_WARNING (CWE-404): [#def11] createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/misc.c:778: error[resourceLeak]: Resource leak: file # 776| curl_easy_strerror(rcode)); # 777| remove(dst); # 778|-> return CRE_CURL; # 779| } # 780| Error: GCC_ANALYZER_WARNING (CWE-476): [#def12] createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/parsehdr.c: scope_hint: In function ‘cr_package_from_header’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/parsehdr.c:282:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘dir_list’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/parsehdr.c: scope_hint: In function ‘cr_package_from_header’ # 280| dir_list = malloc(sizeof(char *) * dir_count); # 281| while (rpmtdNext(dirnames) != -1) { # 282|-> dir_list[x] = cr_safe_string_chunk_insert(pkg->chunk, rpmtdGetString(dirnames)); # 283| x++; # 284| } Error: GCC_ANALYZER_WARNING (CWE-476): [#def13] createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/repomd.c: scope_hint: In function ‘cr_repomd_record_fill’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/repomd.c:287:75: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ # 285| } # 286| md->checksum_open_type = g_string_chunk_insert(md->chunk, checksum_str); # 287|-> md->checksum_open = g_string_chunk_insert(md->chunk, open_stat->checksum); # 288| if (md->size_open == G_GINT64_CONSTANT(-1)) # 289| md->size_open = open_stat->size; Error: GCC_ANALYZER_WARNING (CWE-775): [#def14] createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/sqliterepo_c.c: scope_hint: In function ‘gen_new_repomd’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/sqliterepo_c.c:589:22: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(g_build_filename(tmp_out_repo, "repomd.xml", 0), "w")’ /usr/include/glib-2.0/glib.h:64: included_from: Included from here. createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/sqliterepo_c.c:20: included_from: Included from here. createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/sqliterepo_c.c:1018:5: note: in expansion of macro ‘g_debug’ /usr/include/glib-2.0/glib/gstring.h:37: included_from: Included from here. /usr/include/glib-2.0/glib/giochannel.h:36: included_from: Included from here. /usr/include/glib-2.0/glib.h:56: included_from: Included from here. createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/sqliterepo_c.c:730:23: note: in expansion of macro ‘g_strdup’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/sqliterepo_c.c: scope_hint: In function ‘gen_new_repomd’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/sqliterepo_c.c:38: included_from: Included from here. createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/sqliterepo_c.c:875:14: note: in expansion of macro ‘cr_db_open_filelists’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/sqliterepo_c.c:882:14: note: in expansion of macro ‘cr_db_open_other’ /usr/lib64/glib-2.0/include/glibconfig.h:9: included_from: Included from here. /usr/include/glib-2.0/glib/gtypes.h:34: included_from: Included from here. /usr/include/glib-2.0/glib/galloca.h:34: included_from: Included from here. /usr/include/glib-2.0/glib.h:32: included_from: Included from here. /usr/include/glib-2.0/glib/gmacros.h:1249:31: note: in expansion of macro ‘_G_BOOLEAN_EXPR_IMPL’ /usr/include/glib-2.0/glib/gmacros.h:1251:45: note: in expansion of macro ‘_G_BOOLEAN_EXPR’ /usr/include/glib-2.0/glib/gstrfuncs.h:166:11: note: in expansion of macro ‘G_UNLIKELY’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/sqliterepo_c.c:506:9: note: in expansion of macro ‘g_str_has_prefix’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/sqliterepo_c.c:543:9: note: in expansion of macro ‘g_debug’ # 587| // Write the repomd.xml # 588| _cleanup_file_fclose_ FILE *f_repomd = NULL; # 589|-> if (!(f_repomd = fopen(repomd_path, "w"))) { # 590| g_set_error(err, CREATEREPO_C_ERROR, CRE_IO, # 591| "Cannot open %s: %s", repomd_path, g_strerror(errno)); Error: GCC_ANALYZER_WARNING (CWE-401): [#def15] createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/sqliterepo_c.c:589:22: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(g_build_filename(tmp_out_repo, "repomd.xml", 0), "w")’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/sqliterepo_c.c:1018:5: note: in expansion of macro ‘g_debug’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/sqliterepo_c.c:730:23: note: in expansion of macro ‘g_strdup’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/sqliterepo_c.c: scope_hint: In function ‘gen_new_repomd’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/sqliterepo_c.c:875:14: note: in expansion of macro ‘cr_db_open_filelists’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/sqliterepo_c.c:882:14: note: in expansion of macro ‘cr_db_open_other’ /usr/include/glib-2.0/glib/gmacros.h:1249:31: note: in expansion of macro ‘_G_BOOLEAN_EXPR_IMPL’ /usr/include/glib-2.0/glib/gmacros.h:1251:45: note: in expansion of macro ‘_G_BOOLEAN_EXPR’ /usr/include/glib-2.0/glib/gstrfuncs.h:166:11: note: in expansion of macro ‘G_UNLIKELY’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/sqliterepo_c.c:506:9: note: in expansion of macro ‘g_str_has_prefix’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/sqliterepo_c.c:543:9: note: in expansion of macro ‘g_debug’ # 587| // Write the repomd.xml # 588| _cleanup_file_fclose_ FILE *f_repomd = NULL; # 589|-> if (!(f_repomd = fopen(repomd_path, "w"))) { # 590| g_set_error(err, CREATEREPO_C_ERROR, CRE_IO, # 591| "Cannot open %s: %s", repomd_path, g_strerror(errno)); Error: CPPCHECK_WARNING (CWE-404): [#def16] createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/sqliterepo_c.c:602: error[resourceLeak]: Resource leak: f_repomd # 600| cr_repomd_free(repomd); # 601| # 602|-> return TRUE; # 603| } # 604| Error: GCC_ANALYZER_WARNING (CWE-476): [#def17] createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/xml_file.c: scope_hint: In function ‘write_modified_header’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/xml_file.c:365:22: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘cr_file’ # 363| gchar *pointer_to_pkgs_end = pointer_to_pkgs + task_count_string_len; # 364| # 365|-> bytes_written += cr_write(cr_file->f, header_buf, pointer_to_pkgs - header_buf, &tmp_err); # 366| if (!tmp_err) # 367| bytes_written += cr_write(cr_file->f, package_count_string, package_count_string_len, &tmp_err); Error: GCC_ANALYZER_WARNING (CWE-476): [#def18] createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/xml_file.c: scope_hint: In function ‘cr_rewrite_header_package_count’ createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/xml_file.c:416:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ # 414| size_t zck_dict_size = 0; # 415| if (g_file_get_contents(zck_dict_file, &zck_dict, &zck_dict_size, &tmp_err)){ # 416|-> cr_set_dict(new_file->f, zck_dict, zck_dict_size, &tmp_err); # 417| g_free(zck_dict); # 418| } else { Error: GCC_ANALYZER_WARNING (CWE-476): [#def19] createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/xml_file.c:446:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ # 444| len_read = cr_get_zchunk_with_index(original_file, zchunk_index, ©_buf, &tmp_err); # 445| if (!tmp_err) # 446|-> cr_write(new_file->f, copy_buf, len_read, &tmp_err); # 447| if (!tmp_err) # 448| cr_end_chunk(new_file->f, &tmp_err); Error: GCC_ANALYZER_WARNING (CWE-476): [#def20] createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/xml_file.c:476:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ # 474| len_read = cr_read(original_file, copy_buf, XML_RECOMPRESS_BUFFER_SIZE, &tmp_err); # 475| if (!tmp_err) # 476|-> cr_write(new_file->f, copy_buf, len_read, &tmp_err); # 477| if (tmp_err) { # 478| g_propagate_prefixed_error(err, tmp_err, "Error encountered while recompressing:"); Error: GCC_ANALYZER_WARNING (CWE-476): [#def21] createrepo_c-1.1.4-build/createrepo_c-1.1.4/src/xml_file.c:487:22: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ # 485| } # 486| # 487|-> new_file->header = 1; # 488| new_file->footer = 1; # 489|
analyzer-version-clippy | 1.82.0 |
analyzer-version-cppcheck | 2.16.0 |
analyzer-version-gcc | 14.2.1 |
analyzer-version-gcc-analyzer | 15.0.0 |
analyzer-version-shellcheck | 0.10.0 |
analyzer-version-unicontrol | 0.0.2 |
enabled-plugins | clippy, cppcheck, gcc, shellcheck, unicontrol |
exit-code | 0 |
host | ip-172-16-1-94.us-west-2.compute.internal |
mock-config | fedora-rawhide-gcc-latest-x86_64 |
project-name | createrepo_c-1.1.4-2.fc42 |
store-results-to | /tmp/tmpc7ikms1v/createrepo_c-1.1.4-2.fc42.tar.xz |
time-created | 2024-11-12 23:24:06 |
time-finished | 2024-11-12 23:26:02 |
tool | csmock |
tool-args | '/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmpc7ikms1v/createrepo_c-1.1.4-2.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpc7ikms1v/createrepo_c-1.1.4-2.fc42.src.rpm' |
tool-version | csmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9 |