Fixed findings

List of Findings

Error: COMPILER_WARNING (CWE-252): [#def1]
libdnf-0.74.0/libdnf/utils/smartcols/Table.cpp: scope_hint: In member function ‘void Table::removeColumn(const std::shared_ptr<Column>&)’
libdnf-0.74.0/libdnf/utils/smartcols/Table.cpp:104:16: warning[-Wunused-result]: ignoring return value of ‘_FIter std::remove(_FIter, _FIter, const _Tp&) [with _FIter = __gnu_cxx::__normal_iterator<shared_ptr<Column>*, vector<shared_ptr<Column> > >; _Tp = shared_ptr<Column>]’, declared with attribute ‘nodiscard’
#  104 |     std::remove(std::begin(columns), std::end(columns), column);
#      |     ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/15/algorithm:63: included_from: Included from here.
libdnf-0.74.0/libdnf/utils/tinyformat/tinyformat.hpp:144: included_from: Included from here.
libdnf-0.74.0/libdnf/utils/smartcols/Table.hpp:28: included_from: Included from here.
libdnf-0.74.0/libdnf/utils/smartcols/Table.cpp:21: included_from: Included from here.
/usr/include/c++/15/bits/stl_algo.h:772:5: note: declared here
#  772 |     remove(_ForwardIterator __first, _ForwardIterator __last,
#      |     ^~~~~~
#  102|   void Table::removeColumn(const std::shared_ptr<Column> &column)
#  103|   {
#  104|->     std::remove(std::begin(columns), std::end(columns), column);
#  105|       scols_table_remove_column(table, column->column);
#  106|   }

Error: COMPILER_WARNING (CWE-252): [#def2]
libdnf-0.74.0/libdnf/utils/smartcols/Table.cpp: scope_hint: In member function ‘void Table::removeLine(const std::shared_ptr<Line>&)’
libdnf-0.74.0/libdnf/utils/smartcols/Table.cpp:116:16: warning[-Wunused-result]: ignoring return value of ‘_FIter std::remove(_FIter, _FIter, const _Tp&) [with _FIter = __gnu_cxx::__normal_iterator<shared_ptr<Line>*, vector<shared_ptr<Line> > >; _Tp = shared_ptr<Line>]’, declared with attribute ‘nodiscard’
#  116 |     std::remove(std::begin(lines), std::end(lines), line);
#      |     ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/15/bits/stl_algo.h:772:5: note: declared here
#  772 |     remove(_ForwardIterator __first, _ForwardIterator __last,
#      |     ^~~~~~
#  114|   void Table::removeLine(const std::shared_ptr<Line> &line)
#  115|   {
#  116|->     std::remove(std::begin(lines), std::end(lines), line);
#  117|       scols_table_remove_line(table, line->line);
#  118|   }

Error: COMPILER_WARNING (CWE-685): [#def3]
libdnf-0.74.0/tests/hawkey/test_suites.h:24: included_from: Included from here.
libdnf-0.74.0/tests/hawkey/test_goal.cpp:38: included_from: Included from here.
libdnf-0.74.0/tests/hawkey/test_goal.cpp: scope_hint: In function ‘DnfPackage* get_latest_pkg(DnfSack*, const char*)’
libdnf-0.74.0/tests/hawkey/test_goal.cpp:54:17: warning[-Wformat-extra-args]: too many arguments for format
#   54 |                 "get_latest_pkg() failed finding '%s'.", name);
#      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libdnf-0.74.0/tests/hawkey/test_goal.cpp: scope_hint: In instantiation of ‘void assert_list_names(bool, GPtrArray*, ...) [with const char* (* getCharFromPackage)(DnfPackage*) = dnf_package_get_name; GPtrArray = _GPtrArray]’
#/builddir/build/BUILD/libdnf-0.74.0/tests/hawkey/test_goal.cpp:474:45:   required from here
#  474 |     assert_list_names<&dnf_package_get_name>(true, plist, "penny", NULL);
#      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   52|       GPtrArray *plist = hy_query_run(q);
#   53|       fail_unless(plist->len == 1,
#   54|->                 "get_latest_pkg() failed finding '%s'.", name);
#   55|       auto pkg = static_cast<DnfPackage *>(g_object_ref(g_ptr_array_index(plist, 0)));
#   56|       hy_query_free(q);

Error: COMPILER_WARNING (CWE-685): [#def4]
libdnf-0.74.0/tests/hawkey/test_goal.cpp:439:18: warning[-Wformat-extra-args]: too many arguments for format
#  439 |             fail("assert_list_names(): list too short");
#      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  437|       while ((name = va_arg(names, char *)) != NULL) {
#  438|           if (i++ >= count) {
#  439|->             fail("assert_list_names(): list too short");
#  440|           }
#  441|           bool found = false;

Error: COMPILER_WARNING (CWE-685): [#def5]
libdnf-0.74.0/tests/hawkey/test_goal.cpp:449:32: warning[-Wformat-extra-args]: too many arguments for format
#  449 |             fail_unless(false, "assert_list_names(): element '%s' %sfound '%zu'",
#      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  447|           }
#  448|           if ((wanted && !found) || (!wanted && found)) {
#  449|->             fail_unless(false, "assert_list_names(): element '%s' %sfound '%zu'",
#  450|                           name, wanted ? "not ": "", stringVector.size());
#  451|           }

Error: COMPILER_WARNING (CWE-685): [#def6]
libdnf-0.74.0/tests/hawkey/test_goal.cpp:458:33: warning[-Wformat-extra-args]: too many arguments for format
#  458 |         fail_unless(i == count, "assert_list_names(): too many items in the list (%d vs %d)", i, count);
#      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libdnf-0.74.0/tests/hawkey/test_goal.cpp: scope_hint: In instantiation of ‘void assert_list_names(bool, GPtrArray*, ...) [with const char* (* getCharFromPackage)(DnfPackage*) = dnf_package_get_nevra; GPtrArray = _GPtrArray]’
#/builddir/build/BUILD/libdnf-0.74.0/tests/hawkey/test_goal.cpp:1064:50:   required from here
# 1064 |         assert_list_names<&dnf_package_get_nevra>(true, plist, "bloop-2.0-1.noarch", "dog-1-2.x86_64", "fool-1-5.noarch",
#      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1065 |             "flying-3.1-0.x86_64", "pilchard-1.2.4-1.x86_64", "pilchard-1.2.4-1.i686", NULL);
#      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  456|       // already checked above.
#  457|       if (wanted) {
#  458|->         fail_unless(i == count, "assert_list_names(): too many items in the list (%d vs %d)", i, count);
#  459|       }
#  460|       va_end(names);

Error: CPPCHECK_WARNING (CWE-476): [#def7]
libdnf-0.74.0/tests/hawkey/test_iutil.cpp:129: warning[nullPointerOutOfResources]: If resource allocation fails, then there is a possible null pointer dereference: fp
#  127|       fail_unless(dnf_solvfile);
#  128|       fail_unless(solv_userdata_verify(dnf_solvfile.get(), cs_computed));
#  129|->     fclose(fp);
#  130|   
#  131|       g_free(new_file);

Scan Properties

analyzer-version-clippy1.90.0
analyzer-version-cppcheck2.18.3
analyzer-version-gcc15.2.1
analyzer-version-gcc-analyzer16.0.0
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.90.0
diffbase-analyzer-version-cppcheck2.18.3
diffbase-analyzer-version-gcc15.2.1
diffbase-analyzer-version-gcc-analyzer16.0.0
diffbase-analyzer-version-shellcheck0.11.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-10.us-west-2.compute.internal
diffbase-known-false-positives/usr/share/csmock/known-false-positives.js
diffbase-known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-gcc-latest-x86_64
diffbase-project-namelibdnf-0.75.0-1.fc44
diffbase-store-results-to/tmp/tmprlgsfwkj/libdnf-0.75.0-1.fc44.tar.xz
diffbase-time-created2025-10-28 18:57:41
diffbase-time-finished2025-10-28 19:01:13
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'gcc,cppcheck,shellcheck,clippy,unicontrol' '-o' '/tmp/tmprlgsfwkj/libdnf-0.75.0-1.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmprlgsfwkj/libdnf-0.75.0-1.fc44.src.rpm'
diffbase-tool-versioncsmock-3.8.3.20251027.143044.ge6b947b-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-10.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
mock-configfedora-rawhide-gcc-latest-x86_64
project-namelibdnf-0.74.0-10.fc43
store-results-to/tmp/tmpjw725ll5/libdnf-0.74.0-10.fc43.tar.xz
time-created2025-10-28 18:53:13
time-finished2025-10-28 18:57:17
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'gcc,cppcheck,shellcheck,clippy,unicontrol' '-o' '/tmp/tmpjw725ll5/libdnf-0.74.0-10.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpjw725ll5/libdnf-0.74.0-10.fc43.src.rpm'
tool-versioncsmock-3.8.3.20251027.143044.ge6b947b-1.el9