grep-3.12-1.fc43

List of Findings

Error: SHELLCHECK_WARNING (CWE-758): [#def1]
/etc/profile.d/colorgrep.sh:1:1: error[SC2148]: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
#    1|-> # color-grep initialization
#    2|   
#    3|   /usr/libexec/grepconf.sh -c || return

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
grep-3.12/gnulib-tests/struniq.h:118:10: warning[-Wanalyzer-malloc-leak]: leak of 'new_node'
grep-3.12/gnulib-tests/struniq.h:92:5: acquire_memory: allocated here
grep-3.12/gnulib-tests/struniq.h:93:6: branch_false: following 'false' branch (when 'new_node' is non-NULL)...
grep-3.12/gnulib-tests/struniq.h:96:11: branch_false: ...to here
grep-3.12/gnulib-tests/struniq.h:118:10: danger: 'new_node' leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  116|       if (mt) gl_lock_unlock (struniq_lock);
#  117|     }
#  118|->   return new_node->contents;
#  119|   }

Error: COMPILER_WARNING: [#def3]
grep-3.12/lib/dfa.c:2606:12: warning[-Wstringop-overflow=]: writing 1 byte into a region of size 0
# 2606 |   flags[0] |= OPT_QUEUED;
#      |            ^
grep-3.12/lib/ialloc.h:91:10: note: destination object of size 0 allocated by 'calloc'
#   91 |   return calloc (n, s);
#      |          ^
# 2604|       }
# 2605|   
# 2606|->   flags[0] |= OPT_QUEUED;
# 2607|   
# 2608|     position_set merged0;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
grep-3.12/lib/dfa.c:4119:18: warning[-Wanalyzer-malloc-leak]: leak of '*mp.is'
grep-3.12/lib/dfa.c:4152:1: enter_function: entry to 'dfamust'
grep-3.12/lib/dfa.c:4163:22: branch_true: following 'true' branch...
grep-3.12/lib/dfa.c:4165:17: branch_true: ...to here
grep-3.12/lib/dfa.c:4190:16: call_function: calling 'allocmust' from 'dfamust'
grep-3.12/lib/dfa.c:4190:16: return_function: returning to 'dfamust' from 'allocmust'
grep-3.12/lib/dfa.c:4163:22: branch_true: following 'true' branch...
grep-3.12/lib/dfa.c:4165:17: branch_true: ...to here
grep-3.12/lib/dfa.c:4169:16: call_function: calling 'allocmust' from 'dfamust'
# 4117|   allocmust (must *mp, idx_t size)
# 4118|   {
# 4119|->   must *new_mp = xmalloc (sizeof *new_mp);
# 4120|     new_mp->in = xzalloc (sizeof *new_mp->in);
# 4121|     new_mp->left = xizalloc (size);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
grep-3.12/lib/exclude.c:579:11: warning[-Wanalyzer-malloc-leak]: leak of 'xstrdup(pattern)'
#  577|   
#  578|         char *str = xstrdup (pattern);
#  579|->       if ((options & (EXCLUDE_WILDCARDS | FNM_NOESCAPE)) == EXCLUDE_WILDCARDS)
#  580|           unescape_pattern (str);
#  581|         if (hash_insert (ex->head->v.table, str) != str)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def6]
grep-3.12/lib/fts.c:714:12: warning[-Wanalyzer-malloc-leak]: leak of 't2'
grep-3.12/lib/fts.c:1267:1: enter_function: entry to 'fts_build'
grep-3.12/lib/fts.c:1307:16: branch_false: following 'false' branch...
grep-3.12/lib/fts.c:1319:38: branch_false: ...to here
grep-3.12/lib/fts.c:1379:12: branch_false: following 'false' branch...
grep-3.12/lib/fts.c:1389:23: branch_false: ...to here
grep-3.12/lib/fts.c:1389:23: branch_true: following 'true' branch (when 'type != 2')...
grep-3.12/lib/fts.c:1390:30: branch_true: ...to here
grep-3.12/lib/fts.c:1389:23: branch_false: following 'false' branch...
grep-3.12/lib/fts.c:1390:30: branch_false: following 'false' branch...
grep-3.12/lib/fts.c:1392:33: branch_false: ...to here
grep-3.12/lib/fts.c:1390:30: branch_false: following 'false' branch...
grep-3.12/lib/fts.c:1393:34: branch_false: ...to here
grep-3.12/lib/fts.c:1393:34: call_function: calling 'leaf_optimization' from 'fts_build'
#  712|        since the caller is not serious about performance.  */
#  713|     if (!ISSET (FTS_CWDFD))
#  714|->     return 0;
#  715|   
#  716|     if (! h)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
grep-3.12/lib/fts.c:1307:16: warning[-Wanalyzer-malloc-leak]: leak of '**sp.fts_cur.fts_dirp'
grep-3.12/lib/fts.c:1287:12: branch_false: following 'false' branch...
grep-3.12/lib/fts.c:1307:34: branch_false: ...to here
grep-3.12/lib/fts.c:1307:34: acquire_memory: allocated here
grep-3.12/lib/fts.c:1307:16: danger: '**sp.fts_cur.fts_dirp' leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
# 1305|               /* Open the directory for reading.  If this fails, we're done.
# 1306|                  If being called from fts_read, set the fts_info field. */
# 1307|->             if ((cur->fts_dirp = fts_opendir(cur->fts_accpath, &dir_fd)) == NULL)
# 1308|                 {
# 1309|                   if (type == BREAD)

Error: GCC_ANALYZER_WARNING (CWE-476): [#def8]
grep-3.12/lib/fts.c:1599:17: warning[-Wanalyzer-null-dereference]: dereference of NULL 'cp'
grep-3.12/lib/fts.c:1110:1: enter_function: entry to 'rpl_fts_children'
grep-3.12/lib/fts.c:1115:12: branch_false: following 'false' branch...
grep-3.12/lib/fts.c:1121:9: branch_false: ...to here
grep-3.12/lib/fts.c:1130:12: branch_false: following 'false' branch...
grep-3.12/lib/fts.c:1134:13: branch_false: ...to here
grep-3.12/lib/fts.c:1134:12: branch_false: following 'false' branch...
grep-3.12/lib/fts.c:1142:12: branch_false: ...to here
grep-3.12/lib/fts.c:1142:12: branch_false: following 'false' branch...
grep-3.12/lib/fts.c:1146:13: branch_false: ...to here
grep-3.12/lib/fts.c:1149:12: branch_false: following 'false' branch (when 'instr != 4096')...
grep-3.12/lib/fts.c:1162:13: branch_false: ...to here
grep-3.12/lib/fts.c:1164:41: call_function: calling 'fts_build' from 'rpl_fts_children'
# 1597|                   if (len == sp->fts_pathlen || nitems == 0)
# 1598|                           --cp;
# 1599|->                 *cp = '\0';
# 1600|           }
# 1601|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
grep-3.12/lib/ialloc.h:57:10: warning[-Wanalyzer-malloc-leak]: leak of 'ximalloc(s + 1)'
grep-3.12/lib/xmalloc.c:327:1: enter_function: entry to 'ximemdup0'
grep-3.12/lib/xmalloc.c:329:18: call_function: calling 'ximalloc' from 'ximemdup0'
#   55|   imalloc (idx_t s)
#   56|   {
#   57|->   return s <= SIZE_MAX ? malloc (s) : _gl_alloc_nomem ();
#   58|   }
#   59|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def10]
grep-3.12/lib/ialloc.h:57:10: warning[-Wanalyzer-malloc-leak]: leak of 'ximalloc(s)'
grep-3.12/lib/xmalloc.c:318:1: enter_function: entry to 'ximemdup'
grep-3.12/lib/xmalloc.c:320:18: call_function: calling 'ximalloc' from 'ximemdup'
#   55|   imalloc (idx_t s)
#   56|   {
#   57|->   return s <= SIZE_MAX ? malloc (s) : _gl_alloc_nomem ();
#   58|   }
#   59|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def11]
grep-3.12/lib/ialloc.h:91:10: warning[-Wanalyzer-malloc-leak]: leak of 'xicalloc(s, 1)'
grep-3.12/lib/xmalloc.c:287:1: enter_function: entry to 'xizalloc'
grep-3.12/lib/xmalloc.c:289:10: call_function: calling 'xicalloc' from 'xizalloc'
#   89|         s = 0;
#   90|       }
#   91|->   return calloc (n, s);
#   92|   }
#   93|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def12]
grep-3.12/lib/xmalloc.c:45:10: warning[-Wanalyzer-malloc-leak]: leak of 'xmalloc(n)'
grep-3.12/lib/xmalloc.c:55:1: enter_function: entry to 'xcharalloc'
grep-3.12/lib/xmalloc.c:57:10: call_function: calling 'xmalloc' from 'xcharalloc'
#   43|   xmalloc (size_t s)
#   44|   {
#   45|->   return check_nonnull (malloc (s));
#   46|   }
#   47|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def13]
grep-3.12/lib/xmalloc.c:45:10: warning[-Wanalyzer-malloc-leak]: leak of 'xmalloc(s)'
grep-3.12/lib/xmalloc.c:312:1: enter_function: entry to 'xmemdup'
grep-3.12/lib/xmalloc.c:314:18: call_function: calling 'xmalloc' from 'xmemdup'
#   43|   xmalloc (size_t s)
#   44|   {
#   45|->   return check_nonnull (malloc (s));
#   46|   }
#   47|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def14]
grep-3.12/lib/xmalloc.c:298:10: warning[-Wanalyzer-malloc-leak]: leak of 'xcalloc(s, 1)'
grep-3.12/lib/xmalloc.c:281:1: enter_function: entry to 'xzalloc'
grep-3.12/lib/xmalloc.c:283:10: call_function: calling 'xcalloc' from 'xzalloc'
#  296|   xcalloc (size_t n, size_t s)
#  297|   {
#  298|->   return check_nonnull (calloc (n, s));
#  299|   }
#  300|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def15]
grep-3.12/lib/xmalloc.c:314:10: warning[-Wanalyzer-malloc-leak]: leak of 'xmemdup(string,  strlen(string) + 1)'
grep-3.12/lib/xmalloc.c:337:1: enter_function: entry to 'xstrdup'
grep-3.12/lib/xmalloc.c:339:10: call_function: calling 'xmemdup' from 'xstrdup'
#  312|   xmemdup (void const *p, size_t s)
#  313|   {
#  314|->   return memcpy (xmalloc (s), p, s);
#  315|   }
#  316|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def16]
grep-3.12/src/dfasearch.c:207:20: warning[-Wanalyzer-malloc-leak]: leak of 'xcalloc(1, 72)'
grep-3.12/src/dfasearch.c:241:10: branch_false: following 'false' branch...
grep-3.12/src/dfasearch.c:254:28: branch_false: ...to here
grep-3.12/src/dfasearch.c:269:10: branch_false: following 'false' branch...
grep-3.12/src/dfasearch.c:275:10: branch_false: ...to here
grep-3.12/src/dfasearch.c:207:20: danger: 'xcalloc(1, 72)' leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  205|     int dfaopts = (DFA_CONFUSING_BRACKETS_ERROR | DFA_STRAY_BACKSLASH_WARN
#  206|                    | DFA_PLUS_WARN
#  207|->                  | (syntax_bits & RE_CONTEXT_INDEP_OPS ? DFA_STAR_WARN : 0)
#  208|                    | (eolbyte ? 0 : DFA_EOL_NUL));
#  209|     dfasyntax (dc->dfa, &localeinfo, syntax_bits, dfaopts);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def17]
grep-3.12/src/dfasearch.c:230:9: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
#  228|     char *buf = nullptr;
#  229|     idx_t buflen = 0;
#  230|->   idx_t bufalloc = 0;
#  231|   
#  232|     idx_t lineno = 0;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def18]
grep-3.12/src/pcresearch.c:162:7: warning[-Wanalyzer-malloc-leak]: leak of 'ximalloc(56)'
grep-3.12/src/pcresearch.c:162:6: branch_true: following 'true' branch...
grep-3.12/src/pcresearch.c:165:11: branch_true: ...to here
grep-3.12/src/pcresearch.c:162:7: danger: 'ximalloc(56)' leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  160|     pcre2_compile_context *ccontext = pcre2_compile_context_create (gcontext);
#  161|   
#  162|->   if (localeinfo.multibyte)
#  163|       {
#  164|         uint32_t unicode;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def19]
grep-3.12/src/searchutils.c:58:10: warning[-Wanalyzer-malloc-leak]: leak of 'trans'
grep-3.12/src/searchutils.c:48:6: branch_true: following 'true' branch...
grep-3.12/src/searchutils.c:48:23: branch_true: ...to here
grep-3.12/src/searchutils.c:54:23: branch_true: following 'true' branch (when 'i != 256')...
grep-3.12/src/searchutils.c:55:20: branch_true: ...to here
grep-3.12/src/searchutils.c:58:10: danger: 'trans' leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#   56|       }
#   57|   
#   58|->   return kwsalloc (trans);
#   59|   }
#   60|   

Scan Properties

analyzer-version-clippy1.86.0
analyzer-version-cppcheck2.17.1
analyzer-version-gcc15.0.1
analyzer-version-gcc-analyzer15.0.1
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-181.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250425.124705.g1c7c448.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-namegrep-3.12-1.fc43
store-results-to/tmp/tmp02knx2vg/grep-3.12-1.fc43.tar.xz
time-created2025-04-25 12:52:04
time-finished2025-04-25 12:54:12
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'unicontrol,cppcheck,gcc,clippy,shellcheck' '-o' '/tmp/tmp02knx2vg/grep-3.12-1.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmp02knx2vg/grep-3.12-1.fc43.src.rpm'
tool-versioncsmock-3.8.1.20250422.172604.g26bc3d6-1.el9