[Home]

Summary:ASTERISK-14573: [patch] "core show codecs" segfaults on Solaris.
Reporter:Chris Walton (crjw)Labels:
Date Opened:2010-01-09 01:27:01.000-0600Date Closed:2010-01-10 13:37:31.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/Portability
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) frame_changes.patch
Description:Running "core show codecs" or "core show codec x" causes a segmentation fault.
This problem may be limited to Solaris.

****** ADDITIONAL INFORMATION ******

The problem is due to an invalid conversion string passed to vsnprintf.
This happens twice in main/frame.c:
line 707:  "%19Lu"
line 742:  "%11Lu"

The printf man pages on both Linux and Solaris do not show "L" as being a valid modifier for type "u".
I assume that nobody noticed because "%Lu" magically works on Linux.
The correct conversion string for an unsigned-long-long is "%llu".


Changing both instances of "Lu" to "llu" in frame.c allows "core show codecs" to run cleanly on Solaris without crashing asterisk.


Below is a stack trace taken with the unfixed code:
libc_hwcap1.so.1`strlen+0xb(81909ec, 80474a8, 8047410, 0)
libc_hwcap1.so.1`vsnprintf+0x65(825ab7c, 100, 81909ec, 80474a8, 4b4827e8, 294ac)
__ast_str_helper+0x3d(804748c, 0, 0, 81909ec, 80474a8, 80b2a44)
ast_cli+0x5b(1, 81909ec, 2, 0, 1, 8047520)
show_codecs+0x249(81b0ca0, fffffffc, 8047600, 1)
ast_cli_command_full+0x111(ffffffff, ffffffff, 1, 81d6d28)
main+0x2544(2, 8047da4, 8047db0, 8047d98, 807316e, 8162800)
_start+0x83(2, 8047e58, 8047e61, 0, 8047e64, 8047ea0)
Comments:By: Digium Subversion (svnbot) 2010-01-10 13:37:31.000-0600

Repository: asterisk
Revision: 239074

U   trunk/addons/chan_ooh323.c
U   trunk/channels/chan_iax2.c
U   trunk/main/frame.c

------------------------------------------------------------------------
r239074 | tilghman | 2010-01-10 13:37:30 -0600 (Sun, 10 Jan 2010) | 8 lines

According to POSIX, the capital L modifier applies only to floating point types.
Fixes a crash on Solaris.
(closes issue ASTERISK-14573)
Reported by: crjw
Patches:
      frame_changes.patch uploaded by crjw (license 963)
      Plus several others found and fixed by me

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=239074