https://bugs.exim.org/show_bug.cgi?id=2686
Bug ID: 2686
Summary: Compiler warnings under -fanalyzer and GCC 10.2
Product: PCRE
Version: 10.36 (PCRE2)
Hardware: x86-64
OS: Linux
Status: NEW
Severity: bug
Priority: medium
Component: Code
Assignee: Philip.Hazel@???
Reporter: dangelog@???
CC: pcre-dev@???
Hi,
When compiling PCRE2 10.36 under GCC 10.2 with the -fanalyzer command line
option, I get the warning reported below (the paths are relative to the PCRE2
copy shipped within Qt). I have no idea if the report is formally correct or
not; if it's a false positive, maybe some asserts could be added to silence the
warning.
Thanks,
../src/3rdparty/pcre2/src/pcre2_auto_possess.c: In function âcompare_opcodesâ:
../src/3rdparty/pcre2/src/pcre2_auto_possess.c:548:5: warning: dereference of
NULL âcodeâ [CWE-690] [-Wanalyzer-null-dereference]
548 | c = *code;
| ~~^~~~~~~
â_pcre2_auto_possessify_16â: event 1
|
|../src/3rdparty/pcre2/src/pcre2_internal.h:1943:51:
| 1943 | #define _pcre2_auto_possessify
PCRE2_SUFFIX(_pcre2_auto_possessify_)
| |
^~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (1) entry to
â_pcre2_auto_possessify_16â
../src/3rdparty/pcre2/src/pcre2.h:796:25: note: in definition of macro
âPCRE2_JOINâ
| 796 | #define PCRE2_JOIN(a,b) a ## b
| | ^
../src/3rdparty/pcre2/src/pcre2.h:975:25: note: in expansion of macro
âPCRE2_GLUEâ
| 975 | #define PCRE2_SUFFIX(a) PCRE2_GLUE(a, PCRE2_CODE_UNIT_WIDTH)
| | ^~~~~~~~~~
../src/3rdparty/pcre2/src/pcre2_internal.h:1943:38: note: in expansion of macro
âPCRE2_SUFFIXâ
| 1943 | #define _pcre2_auto_possessify
PCRE2_SUFFIX(_pcre2_auto_possessify_)
| | ^~~~~~~~~~~~
../src/3rdparty/pcre2/src/pcre2_internal.h:177:20: note: in expansion of macro
â_pcre2_auto_possessifyâ
| 177 | #define PRIV(name) _pcre2_##name
| | ^~~~~~~
../src/3rdparty/pcre2/src/pcre2_auto_possess.c:1114:1: note: in expansion of
macro âPRIVâ
| 1114 | PRIV(auto_possessify)(PCRE2_UCHAR *code, const compile_block *cb)
| | ^~~~
|
â_pcre2_auto_possessify_16â: events 2-12
|
| 1128 | if (c >= OP_TABLE_LENGTH) return -1; /* Something gone wrong
*/
| | ^
| | |
| | (2) following âfalseâ branch (when âc <= 167â)...
| 1129 |
| 1130 | if (c >= OP_STAR && c <= OP_TYPEPOSUPTO)
| | ~
| | |
| | (3) ...to here
|......
| 1177 | else if (c == OP_CLASS || c == OP_NCLASS || c == OP_XCLASS)
| | ~
| | |
| | (4) following âtrueâ branch (when âc == 110â)...
|......
| 1180 | if (c == OP_XCLASS)
| | ~
| | |
| | (5) ...to here
| | (6) following âfalseâ branch (when âc != 112â)...
|......
| 1184 | repeat_opcode = code + 1 + (32 / sizeof(PCRE2_UCHAR));
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (7) ...to here
|......
| 1187 | if (c >= OP_CRSTAR && c <= OP_CRMINRANGE)
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | | |
| | | (9) ...to here
| | | (10) following âtrueâ branch (when âc <=
105â)...
| | (8) following âtrueâ branch (when âc > 97â)...
|......
| 1190 | end = get_chr_property_list(code, utf, ucp, cb->fcc, list);
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (11) ...to here
| | (12) calling âget_chr_property_listâ from
â_pcre2_auto_possessify_16â
|
+--> âget_chr_property_listâ: events 13-14
|
| 308 | get_chr_property_list(PCRE2_SPTR code, BOOL utf, BOOL ucp,
const uint8_t *fcc,
| | ^~~~~~~~~~~~~~~~~~~~~
| | |
| | (13) entry to âget_chr_property_listâ
|......
| 365 | switch(c)
| | ~~~~~~
| | |
| | (14) following âdefault:â branch...
|
âget_chr_property_listâ: event 15
|
| 493 | return NULL; /* Opcode not accepted */
| | ^~~~
| | |
| | (15) ...to here
|
âget_chr_property_listâ: event 16
|
|cc1:
| (16): â<return-value>â is NULL
|
<------+
|
â_pcre2_auto_possessify_16â: events 17-18
|
| 1190 | end = get_chr_property_list(code, utf, ucp, cb->fcc, list);
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (17) return of NULL to â_pcre2_auto_possessify_16â
from âget_chr_property_listâ
|......
| 1194 | if (compare_opcodes(end, utf, ucp, cb, list, end,
&rec_limit))
| |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (18) calling âcompare_opcodesâ from
â_pcre2_auto_possessify_16â
|
+--> âcompare_opcodesâ: events 19-22
|
| 518 | compare_opcodes(PCRE2_SPTR code, BOOL utf, BOOL ucp, const
compile_block *cb,
| | ^~~~~~~~~~~~~~~
| | |
| | (19) entry to âcompare_opcodesâ
|......
| 536 | if (--(*rec_limit) <= 0) return FALSE; /* Recursion has
gone too deep */
| | ~
| | |
| | (20) following âfalseâ branch...
|......
| 548 | c = *code;
| | ~~~~~~~~~
| | |
| | (21) ...to here
| | (22) dereference of NULL âcodeâ
|
--
You are receiving this mail because:
You are on the CC list for the bug.