public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/108400] New: false positive: null dereference
@ 2023-01-13 18:46 chipitsine at gmail dot com
  2023-01-26 17:23 ` [Bug analyzer/108400] false positive: null dereference (SoftEtherVPN) dmalcolm at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: chipitsine at gmail dot com @ 2023-01-13 18:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108400

            Bug ID: 108400
           Summary: false positive: null dereference
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: chipitsine at gmail dot com
  Target Milestone: ---

bug is reproduced on the following gcc version:

commit f54e3b3ba01ced7ecda3caed51b42f707d489c77 (HEAD -> master, origin/trunk,
origin/master, origin/HEAD)
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Thu Jan 12 00:29:33 2023 -0300


repro steps:

git clone --recursive https://github.com/SoftEtherVPN/SoftEtherVPN
cd SoftEtherVPN

export CC=/home/ilia/gcc/gcc-home/bin/gcc
export CFLAGS="-fanalyzer"

cmake .
make




I've reviewed the following finding, which I beleive is false positive

/home/ilia/SoftEtherVPN/src/Cedar/WebUI.c: In function ‘WuExpireSessionKey’:
/home/ilia/SoftEtherVPN/src/Cedar/WebUI.c:1871:29: warning: dereference of NULL
‘0’ [CWE-476] [-Wanalyzer-null-dereference]
 1871 |                 WU_CONTEXT *context = (WU_CONTEXT*)entry->Value;
      |                             ^~~~~~~
  ‘WuExpireSessionKey’: event 1
    |
    | 1868 |         for(i=0; i<LIST_NUM(wu->Contexts); i++)
    |
  ‘WuExpireSessionKey’: event 2
    |
    | 1870 |                 STRMAP_ENTRY *entry =
(STRMAP_ENTRY*)LIST_DATA(wu->Contexts, i);
    |
  ‘WuExpireSessionKey’: event 3
    |
    | 1870 |                 STRMAP_ENTRY *entry =
(STRMAP_ENTRY*)LIST_DATA(wu->Contexts, i);
    |
  ‘WuExpireSessionKey’: event 4
    |
    |/home/ilia/SoftEtherVPN/src/./Mayaqua/Memory.h:116:54:
    |  116 | #define LIST_DATA(o, i)         (((o) != NULL) ? ((o)->p[(i)]) :
NULL)
    |      |                                                   ~~~^~~
    |      |                                                      |
    |      |                                                      (4) ...to
here
/home/ilia/SoftEtherVPN/src/Cedar/WebUI.c:1870:54: note: in expansion of macro
‘LIST_DATA’
    | 1870 |                 STRMAP_ENTRY *entry =
(STRMAP_ENTRY*)LIST_DATA(wu->Contexts, i);
    |      |                                                      ^~~~~~~~~
    |
  ‘WuExpireSessionKey’: event 5
    |
    | 1868 |         for(i=0; i<LIST_NUM(wu->Contexts); i++)
    |
  ‘WuExpireSessionKey’: events 6-7
    |
    | 1870 |                 STRMAP_ENTRY *entry =
(STRMAP_ENTRY*)LIST_DATA(wu->Contexts, i);
    | 1871 |                 WU_CONTEXT *context = (WU_CONTEXT*)entry->Value;
    |      |                             ~~~~~~~    
    |      |                             |
    |      |                             (7) dereference of NULL ‘<unknown>’
    |




WU_CONTEXT *context = (WU_CONTEXT*)entry->Value; - it is variable definition,
there's no dereference.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-06-20  9:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-13 18:46 [Bug analyzer/108400] New: false positive: null dereference chipitsine at gmail dot com
2023-01-26 17:23 ` [Bug analyzer/108400] false positive: null dereference (SoftEtherVPN) dmalcolm at gcc dot gnu.org
2023-01-27 23:01 ` [Bug analyzer/108400] -Wanalyzer-null-dereference false positive on SoftEtherVPN's src/Cedar/WebUI.c dmalcolm at gcc dot gnu.org
2023-03-09 21:21 ` cvs-commit at gcc dot gnu.org
2024-02-16 14:24 ` [Bug analyzer/108400] [12/13/14 Regression] " dmalcolm at gcc dot gnu.org
2024-03-04 12:59 ` rguenth at gcc dot gnu.org
2024-03-04 13:01 ` chipitsine at gmail dot com
2024-03-04 13:02 ` chipitsine at gmail dot com
2024-03-08 15:39 ` law at gcc dot gnu.org
2024-06-20  9:11 ` [Bug analyzer/108400] [12/13/14/15 " rguenth at gcc dot gnu.org
2024-06-20  9:35 ` chipitsine at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).