Fixed defects

List of Defects

Error: CPPCHECK_WARNING: [#def1]
coreutils-9.4-build/coreutils-9.4/lib/mbscasecmp.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING (CWE-682): [#def2]
coreutils-9.4-build/coreutils-9.4/lib/obstack.c:138: error[nullPointerArithmetic]: Pointer addition with NULL pointer.
#  136|     if (!chunk)
#  137|       (*obstack_alloc_failed_handler) ();
#  138|->   h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents,
#  139|                                                  alignment - 1);
#  140|     h->chunk_limit = chunk->limit = (char *) chunk + h->chunk_size;

Error: CPPCHECK_WARNING (CWE-682): [#def3]
coreutils-9.4-build/coreutils-9.4/lib/obstack.c:208: error[nullPointerArithmetic]: Pointer addition with NULL pointer.
#  206|     /* Compute an aligned object_base in the new chunk */
#  207|     object_base =
#  208|->     __PTR_ALIGN ((char *) new_chunk, new_chunk->contents, h->alignment_mask);
#  209|   
#  210|     /* Move the existing object to the new chunk.  */

Error: CPPCHECK_WARNING (CWE-682): [#def4]
coreutils-9.4-build/coreutils-9.4/lib/obstack.c:218: error[nullPointerArithmetic]: Pointer addition with NULL pointer.
#  216|     if (!h->maybe_empty_object
#  217|         && (h->object_base
#  218|->           == __PTR_ALIGN ((char *) old_chunk, old_chunk->contents,
#  219|                             h->alignment_mask)))
#  220|       {

Error: CPPCHECK_WARNING (CWE-682): [#def5]
coreutils-9.4-build/coreutils-9.4/lib/readtokens0.c:55: error[nullPointerArithmetic]: Pointer addition with NULL pointer.
#   53|     /* Don't count the trailing NUL byte in the length.  */
#   54|     size_t len = obstack_object_size (&t->o_data) - 1;
#   55|->   char const *s = obstack_finish (&t->o_data);
#   56|     obstack_ptr_grow (&t->o_tok, s);
#   57|     obstack_grow (&t->o_tok_len, &len, sizeof len);

Error: CLANG_WARNING: [#def6]
coreutils-9.4-build/coreutils-9.4/lib/readtokens0.c:87:7: warning[core.NullDereference]: Dereference of null pointer
#   85|           }
#   86|   
#   87|->       obstack_1grow (&t->o_data, c);
#   88|         if (c == '\0')
#   89|           save_token (t);

Error: CPPCHECK_WARNING (CWE-682): [#def7]
coreutils-9.4-build/coreutils-9.4/lib/readtokens0.c:96: error[nullPointerArithmetic]: Pointer addition with NULL pointer.
#   94|     obstack_ptr_grow (&t->o_tok, NULL);
#   95|   
#   96|->   t->tok = obstack_finish (&t->o_tok);
#   97|     t->tok_len = obstack_finish (&t->o_tok_len);
#   98|     return ! ferror (in);

Error: CPPCHECK_WARNING (CWE-682): [#def8]
coreutils-9.4-build/coreutils-9.4/lib/readtokens0.c:97: error[nullPointerArithmetic]: Pointer addition with NULL pointer.
#   95|   
#   96|     t->tok = obstack_finish (&t->o_tok);
#   97|->   t->tok_len = obstack_finish (&t->o_tok_len);
#   98|     return ! ferror (in);
#   99|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
coreutils-9.4-build/coreutils-9.4/src/basenc.c: scope_hint: In function 'do_decode'
coreutils-9.4-build/coreutils-9.4/src/basenc.c:210:22: warning[-Wanalyzer-malloc-leak]: leak of 'xmalloc((long unsigned int)base_length(4200))'
coreutils-9.4-build/coreutils-9.4/lib/unlocked-io.h:92:46: note: in definition of macro 'fread'
coreutils-9.4-build/coreutils-9.4/src/basenc.c:1030:31: note: in expansion of macro 'BASE_LENGTH'
coreutils-9.4-build/coreutils-9.4/src/basenc.c:1029:21: note: in expansion of macro 'fread'
coreutils-9.4-build/coreutils-9.4/src/basenc.c: scope_hint: In function 'do_decode'
coreutils-9.4-build/coreutils-9.4/lib/unlocked-io.h:92:46: note: in definition of macro 'fread'
coreutils-9.4-build/coreutils-9.4/src/basenc.c:1030:31: note: in expansion of macro 'BASE_LENGTH'
#  208|   
#  209|   
#  210|-> # define BASE_LENGTH base_length
#  211|   
#  212|   /* Note that increasing this may decrease performance if --ignore-garbage

Error: CPPCHECK_WARNING: [#def10]
coreutils-9.4-build/coreutils-9.4/src/chgrp.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-401): [#def11]
coreutils-9.4-build/coreutils-9.4/src/cp.c: scope_hint: In function 'do_copy'
coreutils-9.4-build/coreutils-9.4/src/cp.c:819:10: warning[-Wanalyzer-malloc-leak]: leak of 'dest'
coreutils-9.4-build/coreutils-9.4/src/cp.c:25: included_from: Included from here.
coreutils-9.4-build/coreutils-9.4/src/cp.c:799:14: note: in expansion of macro 'STREQ'
#  817|       }
#  818|   
#  819|->   return ok;
#  820|   }
#  821|   

Error: CPPCHECK_WARNING (CWE-682): [#def12]
coreutils-9.4-build/coreutils-9.4/src/dircolors.c:520: error[nullPointerArithmetic]: Pointer addition with NULL pointer.
#  518|           {
#  519|             size_t len = obstack_object_size (&lsc_obstack);
#  520|->           char *s = obstack_finish (&lsc_obstack);
#  521|             char const *prefix;
#  522|             char const *suffix;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def13]
coreutils-9.4-build/coreutils-9.4/src/env.c: scope_hint: In function 'parse_signal_action_params.part.0'
coreutils-9.4-build/coreutils-9.4/src/env.c:565:10: warning[-Wanalyzer-malloc-leak]: leak of 'xstrdup(optarg)'
#  563|         if (signum == 0)
#  564|           error (0, 0, _("%s: invalid signal"), quote (opt_sig));
#  565|->       if (signum <= 0)
#  566|           usage (exit_failure);
#  567|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def14]
coreutils-9.4-build/coreutils-9.4/src/env.c:568:14: warning[-Wanalyzer-malloc-leak]: leak of 'xstrdup(optarg)'
#  566|           usage (exit_failure);
#  567|   
#  568|->       signals[signum] = set_default ? DEFAULT : IGNORE;
#  569|   
#  570|         opt_sig = strtok (nullptr, ",");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def15]
coreutils-9.4-build/coreutils-9.4/src/env.c: scope_hint: In function 'parse_block_signal_params.part.0'
coreutils-9.4-build/coreutils-9.4/src/env.c:654:10: warning[-Wanalyzer-malloc-leak]: leak of 'xstrdup(optarg)'
#  652|         if (signum == 0)
#  653|           error (0, 0, _("%s: invalid signal"), quote (opt_sig));
#  654|->       if (signum <= 0)
#  655|           usage (exit_failure);
#  656|   

Error: CLANG_WARNING: [#def16]
coreutils-9.4-build/coreutils-9.4/src/join.c:344:13: warning[deadcode.DeadStores]: Value stored to 'sep' during its initialization is never read
#  342|     if (tab != NULL)
#  343|       {
#  344|->       char *sep = ptr;
#  345|         for (; ptr < lim; ptr = sep + mblength)
#  346|   	{

Error: CLANG_WARNING: [#def17]
coreutils-9.4-build/coreutils-9.4/src/join.c:385:13: warning[deadcode.DeadStores]: Value stored to 'mblength' is never read
#  383|           if (mblength == (size_t)-1 || mblength == (size_t)-2)
#  384|             {
#  385|->             mblength = 1;
#  386|               state = state_bak;
#  387|               break;

Error: CLANG_WARNING: [#def18]
coreutils-9.4-build/coreutils-9.4/src/join.c:403:8: warning[deadcode.DeadStores]: Value stored to 'mblength' is never read
#  401|   	  if (mblength == (size_t)-1 || mblength == (size_t)-2)
#  402|   	    {
#  403|-> 	      mblength = 1;
#  404|   	      state = state_bak;
#  405|   	      break;

Error: CLANG_WARNING: [#def19]
coreutils-9.4-build/coreutils-9.4/src/join.c:416:5: warning[deadcode.DeadStores]: Value stored to 'mblength' is never read
#  414|   	      if (mblength == (size_t)-1 || mblength == (size_t)-2)
#  415|   		{
#  416|-> 		  mblength = 1;
#  417|   		  state = state_bak;
#  418|   		  break;

Error: CLANG_WARNING: [#def20]
coreutils-9.4-build/coreutils-9.4/src/join.c:436:8: warning[deadcode.DeadStores]: Value stored to 'mblength' is never read
#  434|   	  if (mblength == (size_t)-1 || mblength == (size_t)-2)
#  435|   	    {
#  436|-> 	      mblength = 1;
#  437|   	      state = state_bak;
#  438|   	      break;

Error: CLANG_WARNING: [#def21]
coreutils-9.4-build/coreutils-9.4/src/join.c:449:5: warning[deadcode.DeadStores]: Value stored to 'mblength' is never read
#  447|   	      if (mblength == (size_t)-1 || mblength == (size_t)-2)
#  448|   		{
#  449|-> 		  mblength = 1;
#  450|   		  state = state_bak;
#  451|   		  break;

Error: CPPCHECK_WARNING (CWE-682): [#def22]
coreutils-9.4-build/coreutils-9.4/src/ls.c:1082: error[nullPointerArithmetic]: Pointer addition with NULL pointer.
# 1080|     if (n_pos > 0)
# 1081|       {
# 1082|->       off_t *pos = obstack_finish (os);
# 1083|         fputs (prefix, stdout);
# 1084|         for (size_t i = 0; i < n_pos; i++)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def23]
coreutils-9.4-build/coreutils-9.4/src/wc.c: scope_hint: In function 'single_binary_main_wc'
coreutils-9.4-build/coreutils-9.4/src/wc.c:724:29: warning[-Wanalyzer-malloc-leak]: leak of 'get_input_fstatus(nfiles,  files)'
coreutils-9.4-build/coreutils-9.4/src/wc.c:778:1: note: in expansion of macro 'main'
#  722|   get_input_fstatus (size_t nfiles, char *const *file)
#  723|   {
#  724|->   struct fstatus *fstatus = xnmalloc (nfiles ? nfiles : 1, sizeof *fstatus);
#  725|   
#  726|     if (nfiles == 0

Error: CPPCHECK_WARNING: [#def24]
coreutils-9.4-build/coreutils-9.4/src/wc_avx2.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Scan Properties

analyzer-version-clang18.1.7
analyzer-version-cppcheck2.14.2
analyzer-version-gcc14.1.1
analyzer-version-gcc-analyzer14.1.1
analyzer-version-shellcheck0.10.0
diffbase-analyzer-version-clang18.1.7
diffbase-analyzer-version-cppcheck2.14.2
diffbase-analyzer-version-gcc14.1.1
diffbase-analyzer-version-gcc-analyzer14.1.1
diffbase-analyzer-version-shellcheck0.10.0
diffbase-enabled-pluginsclang, cppcheck, gcc, shellcheck
diffbase-exit-code0
diffbase-hostip-172-16-1-190.us-west-2.compute.internal
diffbase-mock-configfedora-41-x86_64
diffbase-project-namecoreutils-9.5-2.fc41
diffbase-store-results-to/tmp/tmp5xb8xak4/coreutils-9.5-2.fc41.tar.xz
diffbase-time-created2024-07-03 12:23:36
diffbase-time-finished2024-07-03 12:30:53
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmp5xb8xak4/coreutils-9.5-2.fc41.tar.xz' '--gcc-analyze' '/tmp/tmp5xb8xak4/coreutils-9.5-2.fc41.src.rpm'
diffbase-tool-versioncsmock-3.5.3-1.el9
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-190.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namecoreutils-9.4-6.fc40
store-results-to/tmp/tmplveumlga/coreutils-9.4-6.fc40.tar.xz
time-created2024-07-03 12:15:23
time-finished2024-07-03 12:23:06
titleFixed defects
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmplveumlga/coreutils-9.4-6.fc40.tar.xz' '--gcc-analyze' '/tmp/tmplveumlga/coreutils-9.4-6.fc40.src.rpm'
tool-versioncsmock-3.5.3-1.el9