Task #482 - grep-3.11-8.fc41/scan-results.err
back to task #482download
Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/gnulib-tests/c-strcasestr.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/gnulib-tests/localename.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-401): grep-3.11-build/grep-3.11/gnulib-tests/localename.c: scope_hint: In function 'struniq' grep-3.11-build/grep-3.11/gnulib-tests/localename.c:2716:10: warning[-Wanalyzer-malloc-leak]: leak of 'new_node' # 2714| if (mt) gl_lock_unlock (struniq_lock); # 2715| } # 2716|-> return new_node->contents; # 2717| } # 2718| Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/gnulib-tests/printf-parse.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: grep-3.11-build/grep-3.11/gnulib-tests/strerror_r.c:165:7: warning[deadcode.DeadStores]: Value stored to 'ret' is never read # 163| # 164| { # 165|-> ret = 0; # 166| # 167| # if HAVE___XPG_STRERROR_R Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/gnulib-tests/vasnprintf.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/lib/argmatch.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: grep-3.11-build/grep-3.11/lib/dfa.c:1004:15: warning[deadcode.DeadStores]: Value stored to 'c' is never read # 1002| # 1003| /* Fetch bracket. */ # 1004|-> c = bracket_fetch_wc (dfa); # 1005| wc = dfa->lex.wctok; # 1006| if (c1 == ':') Error: CLANG_WARNING: grep-3.11-build/grep-3.11/lib/dfa.c:1005:15: warning[deadcode.DeadStores]: Value stored to 'wc' is never read # 1003| /* Fetch bracket. */ # 1004| c = bracket_fetch_wc (dfa); # 1005|-> wc = dfa->lex.wctok; # 1006| if (c1 == ':') # 1007| /* Build character class. POSIX allows character Error: CLANG_WARNING: grep-3.11-build/grep-3.11/lib/dfa.c:3484:19: warning[core.NullDereference]: Array access (from variable 'trans') results in a null pointer dereference # 3482| { # 3483| state_num *t; # 3484|-> while ((t = trans[s]) != NULL) # 3485| { # 3486| if (s < d->min_trcount) Error: GCC_ANALYZER_WARNING (CWE-401): grep-3.11-build/grep-3.11/lib/dfa.c: scope_hint: In function 'allocmust' grep-3.11-build/grep-3.11/lib/dfa.c:4096:18: warning[-Wanalyzer-malloc-leak]: leak of '*mp.is' # 4094| allocmust (must *mp, idx_t size) # 4095| { # 4096|-> must *new_mp = xmalloc (sizeof *new_mp); # 4097| new_mp->in = xzalloc (sizeof *new_mp->in); # 4098| new_mp->left = xizalloc (size); Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/lib/exclude.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-401): grep-3.11-build/grep-3.11/lib/exclude.c: scope_hint: In function 'add_exclude' grep-3.11-build/grep-3.11/lib/exclude.c:591:20: warning[-Wanalyzer-malloc-leak]: leak of 'xstrdup(pattern)' # 589| # 590| str = xstrdup (pattern); # 591|-> if ((options & (EXCLUDE_WILDCARDS | FNM_NOESCAPE)) == EXCLUDE_WILDCARDS) # 592| unescape_pattern (str); # 593| p = hash_insert (seg->v.table, str); Error: GCC_ANALYZER_WARNING (CWE-401): grep-3.11-build/grep-3.11/lib/fts.c:225: included_from: Included from here. grep-3.11-build/grep-3.11/lib/fts-cycle.c: scope_hint: In function 'enter_dir' grep-3.11-build/grep-3.11/lib/fts-cycle.c:94:10: warning[-Wanalyzer-malloc-leak]: leak of 'ad' grep-3.11-build/grep-3.11/lib/fts.c:1249:22: note: in expansion of macro 'ISSET' grep-3.11-build/grep-3.11/lib/fts.c:1311:34: note: in expansion of macro 'fts_opendir' grep-3.11-build/grep-3.11/lib/fts.c:1334:19: note: in expansion of macro 'LEAVE_DIR' grep-3.11-build/grep-3.11/lib/fts.c:1334:19: note: in expansion of macro 'LEAVE_DIR' grep-3.11-build/grep-3.11/lib/fts.c:1334:19: note: in expansion of macro 'LEAVE_DIR' # 92| ad_from_table = hash_insert (fts->fts_cycle.ht, ad); # 93| # 94|-> if (ad_from_table != ad) # 95| { # 96| free (ad); Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/lib/fts.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-401): grep-3.11-build/grep-3.11/lib/fts.c: scope_hint: In function 'filesystem_type' grep-3.11-build/grep-3.11/lib/fts.c:714:12: warning[-Wanalyzer-malloc-leak]: leak of 't2' grep-3.11-build/grep-3.11/lib/fts.c:743:13: note: in expansion of macro 'fts_assert' grep-3.11-build/grep-3.11/lib/fts.c:743:13: note: in expansion of macro 'fts_assert' # 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): grep-3.11-build/grep-3.11/lib/fts.c: scope_hint: In function 'fts_build' grep-3.11-build/grep-3.11/lib/fts.c:1311:16: warning[-Wanalyzer-malloc-leak]: leak of '**sp.fts_cur.fts_dirp' grep-3.11-build/grep-3.11/lib/fts.c:1249:22: note: in expansion of macro 'ISSET' grep-3.11-build/grep-3.11/lib/fts.c:1311:34: note: in expansion of macro 'fts_opendir' grep-3.11-build/grep-3.11/lib/fts.c:1311:34: note: in expansion of macro 'fts_opendir' # 1309| /* Open the directory for reading. If this fails, we're done. # 1310| If being called from fts_read, set the fts_info field. */ # 1311|-> if ((cur->fts_dirp = fts_opendir(cur->fts_accpath, &dir_fd)) == NULL) # 1312| { # 1313| if (type == BREAD) Error: GCC_ANALYZER_WARNING (CWE-688): grep-3.11-build/grep-3.11/lib/fts.c:1520:25: warning[-Wanalyzer-null-argument]: use of NULL 'cp' where non-null expected grep-3.11-build/grep-3.11/lib/fts.c:64: included_from: Included from here. grep-3.11-build/grep-3.11/lib/fts.c:1446:17: note: in expansion of macro '__set_errno' grep-3.11-build/grep-3.11/lib/fts.c:1459:22: note: in expansion of macro 'ISSET' <built-in>: note: argument 1 of '__builtin_memmove' must be non-null # 1518| if (ISSET(FTS_NOCHDIR)) { # 1519| p->fts_accpath = p->fts_path; # 1520|-> memmove(cp, p->fts_name, p->fts_namelen + 1); # 1521| } else # 1522| p->fts_accpath = p->fts_name; Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/lib/hash.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-401): grep-3.11-build/grep-3.11/lib/ialloc.h:57:37: warning[-Wanalyzer-malloc-leak]: leak of 'ximalloc(s + 1)' grep-3.11-build/grep-3.11/lib/xmalloc.c: scope_hint: In function 'ximalloc' grep-3.11-build/grep-3.11/lib/xmalloc.c: scope_hint: In function 'ximalloc' # 55| imalloc (idx_t s) # 56| { # 57|-> return s <= SIZE_MAX ? malloc (s) : _gl_alloc_nomem (); # 58| } # 59| Error: GCC_ANALYZER_WARNING (CWE-401): grep-3.11-build/grep-3.11/lib/ialloc.h:57:37: warning[-Wanalyzer-malloc-leak]: leak of 'ximalloc(s)' grep-3.11-build/grep-3.11/lib/xmalloc.c: scope_hint: In function 'ximalloc' grep-3.11-build/grep-3.11/lib/xmalloc.c: scope_hint: In function 'ximalloc' # 55| imalloc (idx_t s) # 56| { # 57|-> return s <= SIZE_MAX ? malloc (s) : _gl_alloc_nomem (); # 58| } # 59| Error: GCC_ANALYZER_WARNING (CWE-401): grep-3.11-build/grep-3.11/lib/ialloc.h:93:10: warning[-Wanalyzer-malloc-leak]: leak of 'xicalloc(s, 1)' grep-3.11-build/grep-3.11/lib/xmalloc.c: scope_hint: In function 'xicalloc' grep-3.11-build/grep-3.11/lib/xmalloc.c: scope_hint: In function 'xicalloc' # 91| s = 0; # 92| } # 93|-> return calloc (n, s); # 94| } # 95| Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/lib/mbscasecmp.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/lib/mbsrtowcs.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/lib/mbsstr.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/lib/memchr2.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/lib/obstack.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING (CWE-682): grep-3.11-build/grep-3.11/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): grep-3.11-build/grep-3.11/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): grep-3.11-build/grep-3.11/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: grep-3.11-build/grep-3.11/lib/propername.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-401): grep-3.11-build/grep-3.11/lib/propername.c: scope_hint: In function 'mbsstr_trimmed_wordbounded' grep-3.11-build/grep-3.11/lib/propername.c:59:10: warning[-Wanalyzer-malloc-leak]: leak of 'trim2(sub, 2)' grep-3.11-build/grep-3.11/lib/propername.c:37: included_from: Included from here. grep-3.11-build/grep-3.11/lib/propername.c:56:16: note: in expansion of macro 'trim' grep-3.11-build/grep-3.11/lib/stdlib.h:36: included_from: Included from here. grep-3.11-build/grep-3.11/lib/propername.c:31: included_from: Included from here. grep-3.11-build/grep-3.11/lib/propername.c:39: included_from: Included from here. grep-3.11-build/grep-3.11/lib/propername.c:72:15: note: in expansion of macro 'mbui_init' grep-3.11-build/grep-3.11/lib/propername.c:79:28: note: in expansion of macro 'mbui_avail' grep-3.11-build/grep-3.11/lib/propername.c:79:28: note: in expansion of macro 'mbui_avail' grep-3.11-build/grep-3.11/lib/mbuiter.h: scope_hint: In function 'mbsstr_trimmed_wordbounded' grep-3.11-build/grep-3.11/lib/propername.c:79:28: note: in expansion of macro 'mbui_avail' grep-3.11-build/grep-3.11/lib/propername.c: scope_hint: In function 'mbsstr_trimmed_wordbounded' grep-3.11-build/grep-3.11/lib/propername.c:79:28: note: in expansion of macro 'mbui_avail' grep-3.11-build/grep-3.11/lib/propername.c:38: included_from: Included from here. grep-3.11-build/grep-3.11/lib/mbuiter.h:210:35: note: in expansion of macro 'mb_isnul' grep-3.11-build/grep-3.11/lib/propername.c:79:28: note: in expansion of macro 'mbui_avail' # 57| bool found = false; # 58| # 59|-> for (; *string != '\0';) # 60| { # 61| const char *tsub_in_string = mbsstr (string, tsub); Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/lib/quotearg.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/lib/striconv.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-401): grep-3.11-build/grep-3.11/lib/striconv.c: scope_hint: In function 'str_cd_iconv' grep-3.11-build/grep-3.11/lib/striconv.c:299:38: warning[-Wanalyzer-malloc-leak]: leak of 'str_cd_iconv(src, iconv_open(to_codeset, from_codeset))' grep-3.11-build/grep-3.11/lib/striconv.c:23: included_from: Included from here. # 297| else if (errno == E2BIG) # 298| { # 299|-> size_t used = outptr - result; # 300| size_t newsize = result_size * 2; # 301| char *newresult; Error: GCC_ANALYZER_WARNING (CWE-401): grep-3.11-build/grep-3.11/lib/striconv.c:338:38: warning[-Wanalyzer-malloc-leak]: leak of 'str_cd_iconv(src, iconv_open(to_codeset, from_codeset))' # 336| if (errno == E2BIG) # 337| { # 338|-> size_t used = outptr - result; # 339| size_t newsize = result_size * 2; # 340| char *newresult; Error: GCC_ANALYZER_WARNING (CWE-401): grep-3.11-build/grep-3.11/lib/striconv.c:367:12: warning[-Wanalyzer-malloc-leak]: leak of 'str_cd_iconv(src, iconv_open(to_codeset, from_codeset))' # 365| # 366| /* Add the terminating NUL byte. */ # 367|-> *outptr++ = '\0'; # 368| # 369| length = outptr - result; Error: GCC_ANALYZER_WARNING (CWE-401): grep-3.11-build/grep-3.11/lib/striconv.c: scope_hint: In function 'str_iconv' grep-3.11-build/grep-3.11/lib/striconv.c:420:10: warning[-Wanalyzer-malloc-leak]: leak of 'iconv_open(to_codeset, from_codeset)' # 418| # endif # 419| cd = iconv_open (to_codeset, from_codeset); # 420|-> if (cd == (iconv_t) -1) # 421| return NULL; # 422| Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/lib/unistr/u8-mbtoucr.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-401): grep-3.11-build/grep-3.11/lib/xmalloc.c: scope_hint: In function 'xmalloc' grep-3.11-build/grep-3.11/lib/xmalloc.c:45:10: warning[-Wanalyzer-malloc-leak]: leak of 'xmalloc(n)' grep-3.11-build/grep-3.11/lib/xmalloc.c:22: included_from: Included from here. grep-3.11-build/grep-3.11/lib/xmalloc.c:57:10: note: in expansion of macro 'XNMALLOC' grep-3.11-build/grep-3.11/lib/xmalloc.c:57:10: note: in expansion of macro 'XNMALLOC' grep-3.11-build/grep-3.11/lib/xmalloc.c: scope_hint: In function 'xmalloc' # 43| xmalloc (size_t s) # 44| { # 45|-> return nonnull (malloc (s)); # 46| } # 47| Error: GCC_ANALYZER_WARNING (CWE-401): grep-3.11-build/grep-3.11/lib/xmalloc.c:45:10: warning[-Wanalyzer-malloc-leak]: leak of 'xmalloc(s)' grep-3.11-build/grep-3.11/lib/xmalloc.c: scope_hint: In function 'xmalloc' # 43| xmalloc (size_t s) # 44| { # 45|-> return nonnull (malloc (s)); # 46| } # 47| Error: GCC_ANALYZER_WARNING (CWE-401): grep-3.11-build/grep-3.11/lib/xmalloc.c: scope_hint: In function 'xcalloc' grep-3.11-build/grep-3.11/lib/xmalloc.c:298:10: warning[-Wanalyzer-malloc-leak]: leak of 'xcalloc(s, 1)' grep-3.11-build/grep-3.11/lib/xmalloc.c: scope_hint: In function 'xcalloc' # 296| xcalloc (size_t n, size_t s) # 297| { # 298|-> return nonnull (calloc (n, s)); # 299| } # 300| Error: GCC_ANALYZER_WARNING (CWE-401): grep-3.11-build/grep-3.11/lib/xmalloc.c: scope_hint: In function 'xmemdup' grep-3.11-build/grep-3.11/lib/xmalloc.c:314:10: warning[-Wanalyzer-malloc-leak]: leak of 'xmemdup(string, strlen(string) + 1)' grep-3.11-build/grep-3.11/lib/xmalloc.c: scope_hint: In function 'xmemdup' # 312| xmemdup (void const *p, size_t s) # 313| { # 314|-> return memcpy (xmalloc (s), p, s); # 315| } # 316| Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/lib/xstrtoimax.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/lib/xstrtol.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING (CWE-758): grep-3.11-build/grep-3.11/lib/xstrtol.c:54: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour # 52| { # 53| __strtol_t scaled; # 54|-> if (INT_MULTIPLY_WRAPV (*x, scale_factor, &scaled)) # 55| { # 56| *x = *x < 0 ? TYPE_MINIMUM (__strtol_t) : TYPE_MAXIMUM (__strtol_t); Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/lib/xstrtoul.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/src/dfasearch.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-401): grep-3.11-build/grep-3.11/src/dfasearch.c: scope_hint: In function 'GEAcompile' grep-3.11-build/grep-3.11/src/dfasearch.c:209:72: warning[-Wanalyzer-malloc-leak]: leak of 'xcalloc(1, 72)' # 207| int dfaopts = (DFA_CONFUSING_BRACKETS_ERROR | DFA_STRAY_BACKSLASH_WARN # 208| | DFA_PLUS_WARN # 209|-> | (syntax_bits & RE_CONTEXT_INDEP_OPS ? DFA_STAR_WARN : 0) # 210| | (eolbyte ? 0 : DFA_EOL_NUL)); # 211| dfasyntax (dc->dfa, &localeinfo, syntax_bits, dfaopts); Error: GCC_ANALYZER_WARNING (CWE-401): grep-3.11-build/grep-3.11/src/dfasearch.c:232:9: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>' # 230| char *buf = NULL; # 231| idx_t buflen = 0; # 232|-> idx_t bufalloc = 0; # 233| # 234| idx_t lineno = 0; Error: CLANG_WARNING: grep-3.11-build/grep-3.11/src/dfasearch.c:249:11: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 247| if (0 < bufshortage) # 248| buf = xpalloc (buf, &bufalloc, bufshortage, -1, 1); # 249|-> memcpy (buf + buflen, prev, prevlen); # 250| buflen += prevlen; # 251| } Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/src/grep.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: grep-3.11-build/grep-3.11/src/grep.c:374:7: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 's') # 372| pr_sgr_start (char const *s) # 373| { # 374|-> if (*s) # 375| print_start_colorize (sgr_start, s); # 376| } Error: CLANG_WARNING: grep-3.11-build/grep-3.11/src/grep.c:380:7: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 's') # 378| pr_sgr_end (char const *s) # 379| { # 380|-> if (*s) # 381| print_end_colorize (sgr_end); # 382| } Error: CLANG_WARNING: grep-3.11-build/grep-3.11/src/grep.c:1331:29: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'line_color') # 1329| } # 1330| # 1331|-> if (!only_matching && *line_color) # 1332| { # 1333| /* This code is exercised at least when grep is invoked like this: Error: CLANG_WARNING: grep-3.11-build/grep-3.11/src/kwsearch.c:77:15: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 75| buf[0] = eolbyte; # 76| } # 77|-> memcpy (buf + 1, p, len); # 78| buf[len + 1] = eolbyte; # 79| p = buf; Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/src/kwset.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING (CWE-682): grep-3.11-build/grep-3.11/src/kwset.c:137: error[nullPointerArithmetic]: Pointer addition with NULL pointer. # 135| obstack_init (&kwset->obstack); # 136| kwset->words = 0; # 137|-> kwset->trie = obstack_alloc (&kwset->obstack, sizeof *kwset->trie); # 138| kwset->trie->accepting = 0; # 139| kwset->trie->links = NULL; Error: CPPCHECK_WARNING (CWE-682): grep-3.11-build/grep-3.11/src/kwset.c:200: error[nullPointerArithmetic]: Pointer addition with NULL pointer. # 198| if (!cur) # 199| { # 200|-> cur = obstack_alloc (&kwset->obstack, sizeof *cur); # 201| cur->llink = NULL; # 202| cur->rlink = NULL; Error: CPPCHECK_WARNING (CWE-682): grep-3.11-build/grep-3.11/src/kwset.c:203: error[nullPointerArithmetic]: Pointer addition with NULL pointer. # 201| cur->llink = NULL; # 202| cur->rlink = NULL; # 203|-> cur->trie = obstack_alloc (&kwset->obstack, sizeof *cur->trie); # 204| cur->trie->accepting = 0; # 205| cur->trie->links = NULL; Error: CPPCHECK_WARNING (CWE-682): grep-3.11-build/grep-3.11/src/kwset.c:423: error[nullPointerArithmetic]: Pointer addition with NULL pointer. # 421| # 422| /* Looking for just one string. Extract it from the trie. */ # 423|-> kwset->target = obstack_alloc (&kwset->obstack, kwset->mind); # 424| curr = kwset->trie; # 425| for (idx_t i = 0; i < kwset->mind; i++) Error: CLANG_WARNING: grep-3.11-build/grep-3.11/src/kwset.c:427:30: warning[core.NullDereference]: Access to field 'links' results in a dereference of a null pointer (loaded from variable 'curr') # 425| for (idx_t i = 0; i < kwset->mind; i++) # 426| { # 427|-> kwset->target[i] = curr->links->label; # 428| curr = curr->next; # 429| } Error: CLANG_WARNING: grep-3.11-build/grep-3.11/src/kwset.c:501:13: warning[core.NullDereference]: Access to field 'links' results in a dereference of a null pointer (loaded from field 'trie') # 499| struct trie **next = trans ? nextbuf : kwset->next; # 500| memset (next, 0, sizeof nextbuf); # 501|-> treenext (kwset->trie->links, next); # 502| int gc1 = -2; # 503| int gc1help = -1; Error: CPPCHECK_WARNING (CWE-682): grep-3.11-build/grep-3.11/src/kwset.c:533: error[nullPointerArithmetic]: Pointer addition with NULL pointer. # 531| { # 532| /* Looking for just one string. Extract it from the trie. */ # 533|-> kwset->target = obstack_alloc (&kwset->obstack, kwset->mind); # 534| curr = kwset->trie; # 535| for (idx_t i = kwset->mind; 0 < i; i--) Error: CPPCHECK_WARNING (CWE-682): grep-3.11-build/grep-3.11/src/kwset.c:546: error[nullPointerArithmetic]: Pointer addition with NULL pointer. # 544| backwards match has failed. Extract it from the trie. */ # 545| kwset->shift # 546|-> = obstack_alloc (&kwset->obstack, # 547| sizeof *kwset->shift * (kwset->mind - 1)); # 548| curr = kwset->trie->next; Error: CLANG_WARNING: grep-3.11-build/grep-3.11/src/kwset.c:780:44: warning[deadcode.DeadStores]: Although the value stored to 'c' is used in the enclosing expression, the value is never actually read from 'c' # 778| if (gc1 < 0) # 779| { # 780|-> while (! (trie = kwset->next[c = tr (trans, *tp++)])) # 781| if (tp >= lim) # 782| return -1; Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/src/pcresearch.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-401): grep-3.11-build/grep-3.11/src/pcresearch.c: scope_hint: In function 'Pcompile' grep-3.11-build/grep-3.11/src/pcresearch.c:164:17: warning[-Wanalyzer-malloc-leak]: leak of 'ximalloc(56)' grep-3.11-build/grep-3.11/src/pcresearch.c:27: included_from: Included from here. # 162| pcre2_compile_context *ccontext = pcre2_compile_context_create (gcontext); # 163| # 164|-> if (localeinfo.multibyte) # 165| { # 166| uint32_t unicode; Error: CPPCHECK_WARNING: grep-3.11-build/grep-3.11/src/searchutils.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-401): grep-3.11-build/grep-3.11/src/searchutils.c: scope_hint: In function 'kwsinit' grep-3.11-build/grep-3.11/src/searchutils.c:58:10: warning[-Wanalyzer-malloc-leak]: leak of 'trans' grep-3.11-build/grep-3.11/lib/stdlib.h:36: included_from: Included from here. grep-3.11-build/grep-3.11/lib/dirname.h:28: included_from: Included from here. grep-3.11-build/grep-3.11/src/system.h:27: included_from: Included from here. grep-3.11-build/grep-3.11/src/search.h:30: included_from: Included from here. grep-3.11-build/grep-3.11/src/searchutils.c:23: included_from: Included from here. grep-3.11-build/grep-3.11/lib/ctype.h:35: included_from: Included from here. grep-3.11-build/grep-3.11/src/system.h:36: included_from: Included from here. # 56| } # 57| # 58|-> return kwsalloc (trans); # 59| } # 60|