[Home]

Summary:ASTERISK-29248: res_pjsip_session: res sometimes uninitialized reported by compiler Clang.
Reporter:Alexander Traud (traud)Labels:
Date Opened:2021-01-15 05:11:11.000-0600Date Closed:2021-01-18 10:32:34.000-0600
Priority:MajorRegression?
Status:Closed/CompleteComponents:Resources/res_pjsip_session
Versions:16.15.1 17.9.1 18.1.1 Frequency of
Occurrence
Related
Issues:
Environment:clang 11.0.0-2 of Ubuntu 20.10Attachments:
Description: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}}.
Comments:By: Asterisk Team (asteriskteam) 2021-01-15 05:11:12.067-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

By: Friendly Automation (friendly-automation) 2021-01-18 10:32:34.511-0600

Change 15328 merged by Friendly Automation:
res_pjsip_session: Avoid sometimes-uninitialized warning with Clang.

[https://gerrit.asterisk.org/c/asterisk/+/15328|https://gerrit.asterisk.org/c/asterisk/+/15328]

By: Friendly Automation (friendly-automation) 2021-01-18 10:38:20.795-0600

Change 15356 merged by Joshua Colp:
res_pjsip_session: Avoid sometimes-uninitialized warning with Clang.

[https://gerrit.asterisk.org/c/asterisk/+/15356|https://gerrit.asterisk.org/c/asterisk/+/15356]

By: Friendly Automation (friendly-automation) 2021-01-18 10:38:37.056-0600

Change 15355 merged by Joshua Colp:
res_pjsip_session: Avoid sometimes-uninitialized warning with Clang.

[https://gerrit.asterisk.org/c/asterisk/+/15355|https://gerrit.asterisk.org/c/asterisk/+/15355]