You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Jiri Daněk (Jira)" <ji...@apache.org> on 2021/11/18 16:52:00 UTC

[jira] [Created] (DISPATCH-2290) Use of uninitialized data

Jiri Daněk created DISPATCH-2290:
------------------------------------

             Summary: Use of uninitialized data
                 Key: DISPATCH-2290
                 URL: https://issues.apache.org/jira/browse/DISPATCH-2290
             Project: Qpid Dispatch
          Issue Type: Bug
    Affects Versions: 1.18.0
            Reporter: Jiri Daněk


https://github.com/jiridanek/qpid-dispatch/runs/4253734843?check_suite_focus=true#step:28:10895

{noformat}
==2028==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x56b3c3 in qd_dispatch /home/runner/work/qpid-dispatch/qpid-dispatch/qpid-dispatch/src/dispatch.c:99:20
    #1 0x4c2346 in main_process /home/runner/work/qpid-dispatch/qpid-dispatch/qpid-dispatch/router/src/main.c:92:16
    #2 0x4c05d8 in main /home/runner/work/qpid-dispatch/qpid-dispatch/qpid-dispatch/router/src/main.c:369:9
    #3 0x7f398fd39b74 in __libc_start_main (/lib64/libc.so.6+0x27b74)
    #4 0x43fdbd in _start (/__w/qpid-dispatch/qpid-dispatch/qpid-dispatch/build/router/qdrouterd+0x43fdbd)

  Uninitialized value was created by an allocation of 'st' in the stack frame of function 'qd_dispatch'
    #0 0x56ab90 in qd_dispatch /home/runner/work/qpid-dispatch/qpid-dispatch/qpid-dispatch/src/dispatch.c:77

SUMMARY: MemorySanitizer: use-of-uninitialized-value /home/runner/work/qpid-dispatch/qpid-dispatch/qpid-dispatch/src/dispatch.c:99:20 in qd_dispatch
{noformat}

{code}
        struct stat st;
        if (stat(python_pkgdir, &st)) {
            qd_error_errno(errno, "Cannot find Python library path '%s'", python_pkgdir);
            return NULL;
        } else if (!S_ISDIR(st.st_mode)) {
            qd_error(QD_ERROR_RUNTIME, "Python library path '%s' not a directory", python_pkgdir);
            return NULL;
        }
{code}

The problem looks obvious. If {{stat}} function fails, dispatch tries to examine {{st.st_mode}}. Looks like a trivial coding mistake.

This issue highlights that we don't currently regularly run undefined-memory checker with qdrouterd.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org