[asterisk-bugs] [JIRA] (ASTERISK-29248) res_pjsip_session: res sometimes uninitialized reported by compiler Clang.
Asterisk Team (JIRA)
noreply at issues.asterisk.org
Thu Mar 11 11:50:21 CST 2021
[ https://issues.asterisk.org/jira/browse/ASTERISK-29248?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Asterisk Team updated ASTERISK-29248:
-------------------------------------
Target Release Version/s: 18.3.0
> res_pjsip_session: res sometimes uninitialized reported by compiler Clang.
> --------------------------------------------------------------------------
>
> Key: ASTERISK-29248
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-29248
> Project: Asterisk
> Issue Type: Bug
> Security Level: None
> Components: Resources/res_pjsip_session
> Affects Versions: 16.15.1, 17.9.1, 18.1.1
> Environment: clang 11.0.0-2 of Ubuntu 20.10
> Reporter: Alexander Traud
> Assignee: Alexander Traud
> Severity: Major
> Target Release: 16.17.0, 18.3.0
>
>
> This issue was caused by the fix for ASTERISK-29014 with [GERRIT-14913|https://gerrit.asterisk.org/14913]. The issue is not only in the latest Asterisk but also in the latest Certified-Asterisk. However, ASTERISK-28809 was not backported to Certified-Asterisk 16.8 either, yet.
> *Steps to Reproduce* (see {{contrib/scripts/install_prereq}}):
> {code}sudo apt install make clang libblocksruntime-dev pkg-config
> sudo apt install libedit-dev libjansson-dev libsqlite3-dev uuid-dev libxml2-dev
> ./configure
> make{code}
> *Result*:
> {code}res_pjsip_session.c:2508:7: warning: variable 'res' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
> if (on_request_creation(session, tdata)) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> res_pjsip_session.c:2520:23: note: uninitialized use occurs here
> SCOPE_EXIT_RTN_VALUE(res, "%s: Sending session refresh SDP via %s\n", ast_sip_session_get_name(session),
> ^~~
> /include/asterisk/logger.h:906:9: note: expanded from macro 'SCOPE_EXIT_RTN_VALUE'
> return __return_value
> ^~~~~~~~~~~~~~
> res_pjsip_session.c:2508:3: note: remove the 'if' if its condition is always true
> if (on_request_creation(session, tdata)) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> res_pjsip_session.c:2507:6: warning: variable 'res' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
> if (on_request_creation) {
> ^~~~~~~~~~~~~~~~~~~
> res_pjsip_session.c:2520:23: note: uninitialized use occurs here
> SCOPE_EXIT_RTN_VALUE(res, "%s: Sending session refresh SDP via %s\n", ast_sip_session_get_name(session),
> ^~~
> /include/asterisk/logger.h:906:9: note: expanded from macro 'SCOPE_EXIT_RTN_VALUE'
> return __return_value
> ^~~~~~~~~~~~~~
> res_pjsip_session.c:2507:2: note: remove the 'if' if its condition is always true
> if (on_request_creation) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~
> res_pjsip_session.c:2193:9: note: initialize the variable 'res' to silence this warning
> int res;
> ^
> = 0{code}The problem is, that {{res}} is used in the label {{end}}.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list