[asterisk-bugs] [JIRA] (ASTERISK-24917) [patch] clang compilation warnings

Diederik de Groot (JIRA) noreply at issues.asterisk.org
Fri Mar 27 12:58:34 CDT 2015


    [ https://issues.asterisk.org/jira/browse/ASTERISK-24917?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=225660#comment-225660 ] 

Diederik de Groot commented on ASTERISK-24917:
----------------------------------------------

Does anyone have a clue how to prevent 
while ((aor_name = strsep(&rest, ","))) {

producing a warning like:
pjsip/dialplan_functions.c:817:365: error: array index 2 is past the end of the array (which contains 2 elements) [-Werror,-Warray-bounds]
  ...((const char *) (","))[1], ((const char *) (","))[1] == '\0') ? __strsep_1c (&rest, __r0) : ((__r2 = ((const char *) (","))[2], __r2 == '\0') ? __strs...
                                                                                                                           ^     ~
pjsip/dialplan_functions.c:817:443: error: array index 3 is past the end of the array (which contains 2 elements) [-Werror,-Warray-bounds]
  ...__r0) : ((__r2 = ((const char *) (","))[2], __r2 == '\0') ? __strsep_2c (&rest, __r0, __r1) : (((const char *) (","))[3] == '\0' ? __strsep_3c (&rest...

Code looks perfectly fine to me, guess i must be missing something

> [patch] clang compilation warnings
> ----------------------------------
>
>                 Key: ASTERISK-24917
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-24917
>             Project: Asterisk
>          Issue Type: Improvement
>      Security Level: None
>          Components: Core/General
>    Affects Versions: 11.17.0, 13.2.0
>         Environment: clang
>            Reporter: Diederik de Groot
>
> clang's static analyzer will throw quite a number warnings / errors during compilation, some of which can be very helpfull in finding corner-case bugs. Will use this issue report to group together a number of reviewboard entries.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list