Subject: | Segfault in Tickit::RenderBuffer->get_cell |
Tests are passing, but a program that uses Tickit::Widget::Layout::Desktop is raising a segfault whenever it hits the ->get_cell call. perl-5.20.0, 32-bit.
I'll try to narrow it down to a proper test case, here's some initial info from a gdb session (with -g flags hacked in):
Program received signal SIGSEGV, Segmentation fault.
0xb72ae577 in XS_Tickit__RenderBuffer__xs_get_cell (cv=0x900d688) at lib/Tickit.xs:1062
1062 SvPOK_on(text); SvUTF8_on(text); SvCUR_set(text, len);
(gdb) bt
#0 0xb72ae577 in XS_Tickit__RenderBuffer__xs_get_cell (cv=0x900d688) at lib/Tickit.xs:1062
#1 0x080edfde in Perl_pp_entersub ()
#2 0x080e713b in Perl_runops_standard ()
#3 0x0807f07e in perl_run ()
#4 0x08060b8d in main ()
(gdb) l
1057 }
1058
1059 len = tickit_renderbuffer_get_cell_text(rb, line, col, NULL, 0);
1060 text = newSV(len + 1);
1061 tickit_renderbuffer_get_cell_text(rb, line, col, SvPVX(text), len + 1);
1062 SvPOK_on(text); SvUTF8_on(text); SvCUR_set(text, len);
1063 XPUSHs(sv_2mortal(text));
1064
1065 mPUSHs(newSVpen(tickit_pen_clone(tickit_renderbuffer_get_cell_pen(rb, line, col)), NULL));
1066
(gdb) p text
$1 = (SV *) 0x9aca808
(gdb) p *text
$2 = {sv_any = 0x0, sv_refcnt = 1, sv_flags = 536888320, sv_u = {svu_pv = 0x9af1120 "", svu_iv = 162468128,
svu_uv = 162468128, svu_rv = 0x9af1120, svu_rx = 0x9af1120, svu_array = 0x9af1120, svu_hash = 0x9af1120,
svu_gp = 0x9af1120, svu_fp = 0x9af1120}}
(gdb) p len
$3 = 4294967295
(gdb) p len + 1
$4 = 0
(gdb) p line
$5 = 0
(gdb) p col
$6 = 42
(gdb) p rb
$7 = (TickitRenderBuffer *) 0x9ad4708
(gdb) p *rb
$8 = {lines = 35, cols = 127, cells = 0x9ad67c8, vc_pos_set = 0, vc_line = 161989160, vc_col = 161777348, xlate_line = -6,
xlate_col = 42, clip = {top = 0, left = 42, lines = 1, cols = 26}, pen = 0x9a7bdf0, depth = 4, stack = 0x9a77948,
texts = 0x9a7aa18, n_texts = 0, size_texts = 4, tmp = 0x9af0d98 "", tmplen = 0, tmpsize = 256}