[asterisk-dev] [Code Review] 4546: clang compiler warning: -Warray-bounds
Diederik de Groot
reviewboard at asterisk.org
Sat Mar 28 06:12:42 CDT 2015
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/4546/#review14929
-----------------------------------------------------------
/branches/13/channels/pjsip/dialplan_functions.c
<https://reviewboard.asterisk.org/r/4546/#comment25546>
Replacing all the instances of
strsep(&..., ",")
by
char delimiter[] = ",";
strsep(&..., delimiter)
as i did in the first iteration of trying to solve this 'warning', would be to big a change (multiple source files affected).
The actual issue is cause by strsep macro optimized version of strsep in bits/strings2.h, which expects a character array to be used for the seperator/delimiter and cannot actually deal correctly with a string pointer.
New solution -> test for this 'errornous' behaviour in configure.ac and prevent strsep being replaced by the _strsep_g from bits/strings2.h if this warning is raised. Do not want to suppress this clang warning completely because it can/could be very usefull in other situations. If this issue get's resolved later on strings2.h we should be able to detect it and use the optimized macro version instead.
- Diederik de Groot
On March 27, 2015, 6:59 p.m., Diederik de Groot wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/4546/
> -----------------------------------------------------------
>
> (Updated March 27, 2015, 6:59 p.m.)
>
>
> Review request for Asterisk Developers.
>
>
> Bugs: ASTERISK-24917
> https://issues.asterisk.org/jira/browse/ASTERISK-24917
>
>
> Repository: Asterisk
>
>
> Description
> -------
>
> 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. clang compiler warning:-Warray-bounds
>
>
> Diffs
> -----
>
> /branches/13/channels/pjsip/dialplan_functions.c 433444
>
> Diff: https://reviewboard.asterisk.org/r/4546/diff/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Diederik de Groot
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150328/b1b867d9/attachment-0001.html>
More information about the asterisk-dev
mailing list