[asterisk-bugs] [JIRA] (ASTERISK-22351) Segfault in LIBEDIT_INTERNAL after tgetstr()

Matt Jordan (JIRA) noreply at issues.asterisk.org
Fri Aug 23 08:41:04 CDT 2013


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

Matt Jordan edited comment on ASTERISK-22351 at 8/23/13 8:40 AM:
-----------------------------------------------------------------

Before the results, I've see this warning when compiling:

{noformat}
root at asterisk:/usr/src/asterisk-1.8.23.0# make
In file included from editline.c:18:0:
term.c: In function 'term_move_to_line':
term.c:572:6: warning: implicit declaration of function 'tputs' [-Wimplicit-function-declaration]
term.c:572:6: warning: implicit declaration of function 'tgoto' [-Wimplicit-function-declaration]
term.c: In function 'term_set':
term.c:929:2: warning: implicit declaration of function 'tgetent' [-Wimplicit-function-declaration]
term.c:947:3: warning: implicit declaration of function 'tgetflag' [-Wimplicit-function-declaration]
term.c:956:3: warning: implicit declaration of function 'tgetnum' [-Wimplicit-function-declaration]
term.c:960:4: warning: implicit declaration of function 'tgetstr' [-Wimplicit-function-declaration]
term.c:960:4: warning: passing argument 3 of 'term_alloc' makes pointer from integer without a cast [enabled by default]
term.c:391:1: note: expected 'const char *' but argument is of type 'int'
term.c: In function 'term_echotc':
term.c:1458:8: warning: assignment makes pointer from integer without a cast [enabled by default]
{noformat}


An now, here you have the results:

{noformat}
(gdb) up
#1  0x0000000000569223 in term_set (el=el at entry=0x83a7f0, term=<optimized out>, term at entry=0x0) at term.c:960
960                             term_alloc(el, t, tgetstr((char *)t->name, &area));

(gdb) info locals
i = 1
buf = "\033[L\000\000\000\000\000Ö\001", '\000' <repeats 22 times>, "âÖÿÿÿ\177", '\000' <repeats 82 times>, "ÖTH÷ÿ\177\000\000\220Óÿÿÿ\177\000\000\200Óÿÿÿ\177\000\000\005\000\000\000\000\000\000\000ðÔÿÿÿ\177\000\000\220Óÿÿÿ\177\000\000\t8E÷ÿ\177\000\000\000\000\000\000\000\000\000\000\022\000\000\000\000\000\000\000\001", '\000' <repeats 15 times>, "\\9X", '\000' <repeats 29 times>, "ÿÿÿÿ\000\000\000\000\naÞ÷", '\000' <repeats 12 times>, "<~E÷\000\000\000\000(", '\000' <repeats 15 times>, "`Òÿÿÿ\177", '\000' <repeats 18 times>, " FK÷ÿ\177", '\000' <repeats 14 times>...
area = 0x7fffffffcc64 ""
t = <optimized out>
oset = {__val = {0, 0, 140737488343076, 140737488343776, 140737488344016, 140737341914684, 140737488343994, 100, 140737488343080, 0, 140737488343959,
    4148712662, 0, 77309399760, 18, 140737488344200}}
nset = {__val = {134217728, 0 <repeats 15 times>}}
lins = <optimized out>
cols = <optimized out>

(gdb) print t
$1 = <optimized out>

(gdb) print t->name
value has been optimized out

(gdb) print *t
value has been optimized out

(gdb) print area
$2 = 0x7fffffffcc64 ""

(gdb)
{noformat}
                
      was (Author: arcanos):
    Before the results, I've see this warning when compiling:

root at asterisk:/usr/src/asterisk-1.8.23.0# make
In file included from editline.c:18:0:
term.c: In function 'term_move_to_line':
term.c:572:6: warning: implicit declaration of function 'tputs' [-Wimplicit-function-declaration]
term.c:572:6: warning: implicit declaration of function 'tgoto' [-Wimplicit-function-declaration]
term.c: In function 'term_set':
term.c:929:2: warning: implicit declaration of function 'tgetent' [-Wimplicit-function-declaration]
term.c:947:3: warning: implicit declaration of function 'tgetflag' [-Wimplicit-function-declaration]
term.c:956:3: warning: implicit declaration of function 'tgetnum' [-Wimplicit-function-declaration]
term.c:960:4: warning: implicit declaration of function 'tgetstr' [-Wimplicit-function-declaration]
term.c:960:4: warning: passing argument 3 of 'term_alloc' makes pointer from integer without a cast [enabled by default]
term.c:391:1: note: expected 'const char *' but argument is of type 'int'
term.c: In function 'term_echotc':
term.c:1458:8: warning: assignment makes pointer from integer without a cast [enabled by default]



An now, here you have the results:

(gdb) up
#1  0x0000000000569223 in term_set (el=el at entry=0x83a7f0, term=<optimized out>, term at entry=0x0) at term.c:960
960                             term_alloc(el, t, tgetstr((char *)t->name, &area));

(gdb) info locals
i = 1
buf = "\033[L\000\000\000\000\000Ö\001", '\000' <repeats 22 times>, "âÖÿÿÿ\177", '\000' <repeats 82 times>, "ÖTH÷ÿ\177\000\000\220Óÿÿÿ\177\000\000\200Óÿÿÿ\177\000\000\005\000\000\000\000\000\000\000ðÔÿÿÿ\177\000\000\220Óÿÿÿ\177\000\000\t8E÷ÿ\177\000\000\000\000\000\000\000\000\000\000\022\000\000\000\000\000\000\000\001", '\000' <repeats 15 times>, "\\9X", '\000' <repeats 29 times>, "ÿÿÿÿ\000\000\000\000\naÞ÷", '\000' <repeats 12 times>, "<~E÷\000\000\000\000(", '\000' <repeats 15 times>, "`Òÿÿÿ\177", '\000' <repeats 18 times>, " FK÷ÿ\177", '\000' <repeats 14 times>...
area = 0x7fffffffcc64 ""
t = <optimized out>
oset = {__val = {0, 0, 140737488343076, 140737488343776, 140737488344016, 140737341914684, 140737488343994, 100, 140737488343080, 0, 140737488343959,
    4148712662, 0, 77309399760, 18, 140737488344200}}
nset = {__val = {134217728, 0 <repeats 15 times>}}
lins = <optimized out>
cols = <optimized out>

(gdb) print t
$1 = <optimized out>

(gdb) print t->name
value has been optimized out

(gdb) print *t
value has been optimized out

(gdb) print area
$2 = 0x7fffffffcc64 ""

(gdb)

                  
> Segfault in LIBEDIT_INTERNAL after tgetstr()
> --------------------------------------------
>
>                 Key: ASTERISK-22351
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-22351
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>    Affects Versions: 1.8.23.0, 11.5.0
>         Environment: HP Proliant DL320e G8
> Debian Wheezy (kernel 3.2.0-4-amd64)
> DAHDI 2.7.0 (no cards installed)
> Libpri 1.4.14
>            Reporter: A. Iglesias
>         Attachments: issueA22351_larger_buf_and_offset.patch, issueA22351_larger_buf.patch
>
>
> New installation in this server. After everything is installed and asterisk started, anytime a try to open an asterisk console with asterisk -vvvvvvvvvr I get a "Segmentation fault" and console doesn't open, but asterisk keeps running. If I stop asterisk and try to start it with asterisk -vvvvvvc, it fails in the same way.
> I've been doing some research, and found a guy with the same problem in the past, related whit the value of the TERM system variable. In my case is "xterm", but if I change it for a non existent value ('lalalala' for example) then console starts.
> Digging deeper, I've found that the problem is in main/editline/term.c , in line 960 when executing this:
> term_alloc(el, t, tgetstr((char *)t->name, &area));
> If I change this line with the one executed when TERM has an unknown value...
> term_alloc(el, t, NULL);
> ... and recompile, then console starts.
>  the problem seems to be in the tgetstr function, because if I add a line just with this...
> tgetstr((char *)t->name, &area);
> ... I get the same error.
> I'll try to get core dump stuff, but maybe with this info is enough at the moment to find a solution. I've been trying to find the problem/solution studying the code, but no luck yet.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.asterisk.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list