pcre2-10.47-1.fc44

List of Findings

Error: CPPCHECK_WARNING (CWE-562): [#def1]
pcre2-10.47/src/pcre2_jit_match_inc.h:62: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#   60|   local_stack.end = local_space + MACHINE_STACK_SIZE;
#   61|   local_stack.top = local_space + MACHINE_STACK_SIZE;
#   62|-> arguments->stack = &local_stack;
#   63|   return executable_func(arguments);
#   64|   }

Error: COMPILER_WARNING (CWE-704): [#def2]
pcre2-10.47/src/pcre2grep.c: scope_hint: In function ‘parse_grep_colors’
pcre2-10.47/src/pcre2grep.c:599:5: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
#  599 | col = strstr(gc, "ms=");
#      |     ^
#  597|   uint32_t len;
#  598|   if (gc == NULL) return NULL;
#  599|-> col = strstr(gc, "ms=");
#  600|   if (col == NULL) col = strstr(gc, "mt=");
#  601|   if (col == NULL) return NULL;

Error: COMPILER_WARNING (CWE-704): [#def3]
pcre2-10.47/src/pcre2grep.c:599:5: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
#  597|   uint32_t len;
#  598|   if (gc == NULL) return NULL;
#  599|-> col = strstr(gc, "ms=");
#  600|   if (col == NULL) col = strstr(gc, "mt=");
#  601|   if (col == NULL) return NULL;

Error: COMPILER_WARNING (CWE-704): [#def4]
pcre2-10.47/src/pcre2grep.c:600:22: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
#  600 | if (col == NULL) col = strstr(gc, "mt=");
#      |                      ^
#  598|   if (gc == NULL) return NULL;
#  599|   col = strstr(gc, "ms=");
#  600|-> if (col == NULL) col = strstr(gc, "mt=");
#  601|   if (col == NULL) return NULL;
#  602|   len = 0;

Error: COMPILER_WARNING (CWE-704): [#def5]
pcre2-10.47/src/pcre2grep.c:600:22: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
#  598|   if (gc == NULL) return NULL;
#  599|   col = strstr(gc, "ms=");
#  600|-> if (col == NULL) col = strstr(gc, "mt=");
#  601|   if (col == NULL) return NULL;
#  602|   len = 0;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def6]
pcre2-10.47/src/pcre2grep.c:870:25: warning[-Wanalyzer-malloc-leak]: leak of ‘opendir(pathname)’
pcre2-10.47/src/pcre2grep.c:3302:1: enter_function: entry to ‘grep_or_recurse’
pcre2-10.47/src/pcre2grep.c:3329:4: branch_false: following ‘false’ branch (when the strings are non-equal)...
pcre2-10.47/src/pcre2grep.c:3341:12: branch_false: ...to here
pcre2-10.47/src/pcre2grep.c:3387:5: call_function: calling ‘isdirectory’ from ‘grep_or_recurse’
pcre2-10.47/src/pcre2grep.c:3387:5: return_function: returning to ‘grep_or_recurse’ from ‘isdirectory’
pcre2-10.47/src/pcre2grep.c:3387:4: branch_true: following ‘true’ branch...
pcre2-10.47/src/pcre2grep.c:3389:7: branch_true: ...to here
pcre2-10.47/src/pcre2grep.c:3389:6: branch_false: following ‘false’ branch...
pcre2-10.47/src/pcre2grep.c:3390:8: branch_false: ...to here
pcre2-10.47/src/pcre2grep.c:3389:7: branch_false: following ‘false’ branch...
pcre2-10.47/src/pcre2grep.c:3393:7: branch_false: ...to here
pcre2-10.47/src/pcre2grep.c:3393:6: branch_true: following ‘true’ branch...
pcre2-10.47/src/pcre2grep.c:3397:27: call_function: inlined call to ‘opendirectory’ from ‘grep_or_recurse’
pcre2-10.47/src/pcre2grep.c:3399:8: branch_false: following ‘false’ branch...
pcre2-10.47/src/pcre2grep.c:3399:8: branch_false: ...to here
pcre2-10.47/src/pcre2grep.c:3409:24: call_function: calling ‘readdirectory’ from ‘grep_or_recurse’
#  868|   for (;;)
#  869|     {
#  870|->   struct dirent *dent = readdir(dir);
#  871|     if (dent == NULL) break;
#  872|     if (strcmp(dent->d_name, ".") != 0 && strcmp(dent->d_name, "..") != 0)

Error: COMPILER_WARNING (CWE-704): [#def7]
pcre2-10.47/src/pcre2grep.c: scope_hint: In function ‘decode_number’
pcre2-10.47/src/pcre2grep.c:1312:20: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 1312 |     char *equals = strchr(op->long_name, '=');
#      |                    ^~~~~~
# 1310|     if (longop)
# 1311|       {
# 1312|->     char *equals = strchr(op->long_name, '=');
# 1313|       int nlen = (equals == NULL)? (int)strlen(op->long_name) :
# 1314|         (int)(equals - op->long_name);

Error: COMPILER_WARNING (CWE-704): [#def8]
pcre2-10.47/src/pcre2grep.c:1312:20: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 1310|     if (longop)
# 1311|       {
# 1312|->     char *equals = strchr(op->long_name, '=');
# 1313|       int nlen = (equals == NULL)? (int)strlen(op->long_name) :
# 1314|         (int)(equals - op->long_name);

Error: CPPCHECK_WARNING (CWE-758): [#def9]
pcre2-10.47/src/pcre2grep.c:1502: error[missingReturn]: Found an exit path from function with non-void return type that has missing return statement
# 1500|         }
# 1501|       }
# 1502|->   break;
# 1503|   
# 1504|     case PCRE2_NEWLINE_ANYCRLF:

Error: GCC_ANALYZER_WARNING (CWE-775): [#def10]
pcre2-10.47/src/pcre2grep.c:3590:43: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(pathname, "rb")’
pcre2-10.47/src/pcre2grep.c:3302:1: enter_function: entry to ‘grep_or_recurse’
pcre2-10.47/src/pcre2grep.c:3329:4: branch_false: following ‘false’ branch (when the strings are non-equal)...
pcre2-10.47/src/pcre2grep.c:3341:12: branch_false: ...to here
pcre2-10.47/src/pcre2grep.c:3389:6: branch_false: following ‘false’ branch...
pcre2-10.47/src/pcre2grep.c:3390:8: branch_false: ...to here
pcre2-10.47/src/pcre2grep.c:3389:7: branch_false: following ‘false’ branch...
pcre2-10.47/src/pcre2grep.c:3393:7: branch_false: ...to here
pcre2-10.47/src/pcre2grep.c:3393:6: branch_false: following ‘false’ branch...
pcre2-10.47/src/pcre2grep.c:3573:8: branch_false: ...to here
pcre2-10.47/src/pcre2grep.c:3573:8: acquire_resource: opened here
pcre2-10.47/src/pcre2grep.c:3580:4: branch_false: following ‘false’ branch...
pcre2-10.47/src/pcre2grep.c:3590:43: branch_false: ...to here
pcre2-10.47/src/pcre2grep.c:3590:6: branch_false: following ‘false’ branch...
pcre2-10.47/src/pcre2grep.c:3590:42: branch_false: ...to here
pcre2-10.47/src/pcre2grep.c:3590:6: call_function: calling ‘pcre2grep’ from ‘grep_or_recurse’
# 3588|   /* Now grep the file */
# 3589|   
# 3590|-> rc = pcre2grep(handle, frtype, pathname, (filenames > FN_DEFAULT ||
# 3591|     (filenames == FN_DEFAULT && !only_one_at_top))? pathname : NULL);
# 3592|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def11]
pcre2-10.47/src/pcre2grep.c:3590:43: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(pathname, "rb")’
pcre2-10.47/src/pcre2grep.c:3302:1: enter_function: entry to ‘grep_or_recurse’
pcre2-10.47/src/pcre2grep.c:3329:4: branch_false: following ‘false’ branch (when the strings are non-equal)...
pcre2-10.47/src/pcre2grep.c:3341:12: branch_false: ...to here
pcre2-10.47/src/pcre2grep.c:3389:6: branch_false: following ‘false’ branch...
pcre2-10.47/src/pcre2grep.c:3390:8: branch_false: ...to here
pcre2-10.47/src/pcre2grep.c:3389:7: branch_false: following ‘false’ branch...
pcre2-10.47/src/pcre2grep.c:3393:7: branch_false: ...to here
pcre2-10.47/src/pcre2grep.c:3393:6: branch_false: following ‘false’ branch...
pcre2-10.47/src/pcre2grep.c:3573:8: branch_false: ...to here
pcre2-10.47/src/pcre2grep.c:3573:8: acquire_memory: allocated here
pcre2-10.47/src/pcre2grep.c:3580:4: branch_false: following ‘false’ branch...
pcre2-10.47/src/pcre2grep.c:3590:43: branch_false: ...to here
pcre2-10.47/src/pcre2grep.c:3590:6: branch_false: following ‘false’ branch...
pcre2-10.47/src/pcre2grep.c:3590:42: branch_false: ...to here
pcre2-10.47/src/pcre2grep.c:3590:6: call_function: calling ‘pcre2grep’ from ‘grep_or_recurse’
# 3588|   /* Now grep the file */
# 3589|   
# 3590|-> rc = pcre2grep(handle, frtype, pathname, (filenames > FN_DEFAULT ||
# 3591|     (filenames == FN_DEFAULT && !only_one_at_top))? pathname : NULL);
# 3592|   

Error: COMPILER_WARNING (CWE-704): [#def12]
pcre2-10.47/src/pcre2grep.c: scope_hint: In function ‘main’
pcre2-10.47/src/pcre2grep.c:4010:21: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 4010 |       char *opbra = strchr(op->long_name, '(');
#      |                     ^~~~~~
# 4008|       for (op = optionlist; op->one_char != 0; op++)
# 4009|         {
# 4010|->       char *opbra = strchr(op->long_name, '(');
# 4011|         char *equals = strchr(op->long_name, '=');
# 4012|   

Error: COMPILER_WARNING (CWE-704): [#def13]
pcre2-10.47/src/pcre2grep.c:4010:21: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 4008|       for (op = optionlist; op->one_char != 0; op++)
# 4009|         {
# 4010|->       char *opbra = strchr(op->long_name, '(');
# 4011|         char *equals = strchr(op->long_name, '=');
# 4012|   

Error: COMPILER_WARNING (CWE-704): [#def14]
pcre2-10.47/src/pcre2grep.c:4011:22: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 4011 |       char *equals = strchr(op->long_name, '=');
#      |                      ^~~~~~
# 4009|         {
# 4010|         char *opbra = strchr(op->long_name, '(');
# 4011|->       char *equals = strchr(op->long_name, '=');
# 4012|   
# 4013|         /* Handle options with only one spelling of the name */

Error: COMPILER_WARNING (CWE-704): [#def15]
pcre2-10.47/src/pcre2grep.c:4011:22: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type
# 4009|         {
# 4010|         char *opbra = strchr(op->long_name, '(');
# 4011|->       char *equals = strchr(op->long_name, '=');
# 4012|   
# 4013|         /* Handle options with only one spelling of the name */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def16]
pcre2-10.47/src/pcre2grep.c:4142:7: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘op’
pcre2-10.47/src/pcre2grep.c:3968:13: branch_true: following ‘true’ branch (when ‘i < argc’)...
pcre2-10.47/src/pcre2grep.c:3975:11: branch_true: ...to here
pcre2-10.47/src/pcre2grep.c:3975:6: branch_false: following ‘false’ branch...
pcre2-10.47/src/pcre2grep.c:3980:7: branch_false: ...to here
pcre2-10.47/src/pcre2grep.c:3980:6: branch_false: following ‘false’ branch...
pcre2-10.47/src/pcre2grep.c:3988:6: branch_false: ...to here
pcre2-10.47/src/pcre2grep.c:4097:12: branch_false: following ‘false’ branch...
pcre2-10.47/src/pcre2grep.c:4142:7: branch_false: ...to here
pcre2-10.47/src/pcre2grep.c:4142:7: danger: dereference of NULL ‘op’
# 4140|     something in the PCRE options. */
# 4141|   
# 4142|->   if (op->type == OP_NODATA)
# 4143|       {
# 4144|       pcre2_options = handle_option(op->one_char, pcre2_options);

Error: CPPCHECK_WARNING (CWE-823): [#def17]
pcre2-10.47/src/pcre2test.c:1886: error[arrayIndexOutOfBounds]: Array 'utf8_table2[6]' accessed at index 6, which is out of bounds.
# 1884|     cvalue >>= 6;
# 1885|     }
# 1886|-> *utf8bytes = utf8_table2[i] | cvalue;
# 1887|   return i + 1;
# 1888|   }

Scan Properties

analyzer-version-clippy1.92.0
analyzer-version-cppcheck2.19.1
analyzer-version-gcc16.0.0
analyzer-version-gcc-analyzer16.0.0
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-34.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-x86_64
project-namepcre2-10.47-1.fc44
store-results-to/tmp/tmpnvjeu62d/pcre2-10.47-1.fc44.tar.xz
time-created2026-01-08 20:24:02
time-finished2026-01-08 20:28:13
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmpnvjeu62d/pcre2-10.47-1.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpnvjeu62d/pcre2-10.47-1.fc44.src.rpm'
tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9