msgpack/msgpack — Issue #91: Segfault when unpacking huge message
Author: postmodern
Created: 2011-11-01 05:19:29+00:00
State: open

I was performing some benchmarks with a huge message and found a repeatable segfault:

user system total real
msgpack (1)
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff128dbbb in template_callback_raw (o=, l=50,
p=0x7ffff10e38c3 "\\x08download\\tmicrosoft\\x03com\\x05nsatc\\x03net\\x00\242ts\313@2\235\064X\315 \260\205\245query\261crl.microsoft.com\246server\251\061\060.0.2.15\244type\005\250respons", , b=, u=)
at unpack.c:137
137	ENCODING_SET(*o, s_enc_utf8);
Missing separate debuginfos, use: debuginfo-install glibc-2.14-5.x86_64 nss-softokn-freebl-3.12.10-2.fc15.x86_64
(gdb) bt
#0 0x00007ffff128dbbb in template_callback_raw (o=, l=50,
p=0x7ffff10e38c3 "\\x08download\\tmicrosoft\\x03com\\x05nsatc\\x03net\\x00\242ts\313@2\235\064X\315 \260\205\245query\261crl.microsoft.com\246server\251\061\060.0.2.15\244type\005\250respons", , b=, u=)
at unpack.c:137
#1 template_execute (off=0x7fffffffd320, len=, data=,
ctx=0x7fffffffcea0) at ../msgpack/unpack_template.h:311
#2 template_execute_do (argv=) at unpack.c:175
#3 0x00007ffff7e4466b in rb_rescue2 (b_proc=0x7ffff128d830 ,
data1=140737488343808, r_proc=0x7ffff128d810 , data2=4)
at eval.c:646
#4 0x00007ffff128ed65 in template_execute_wrap (from=0x7fffffffd320, dlen=1719037,
str=14163600, mp=0x7fffffffcea0) at unpack.c:195
#5 MessagePack_unpack_impl (data=14163600, dlen=1719037, self=)
at unpack.c:726
#6 0x00007ffff7f4b28e in vm_call_cfunc (me=0xd99d80, blockptr=0x0, recv=14165040,
num=1, reg_cfp=0x7ffff1998ae8, th=) at vm_insnhelper.c:402
#7 vm_call_method (th=, cfp=0x7ffff1998ae8, num=,
blockptr=0x0, flag=, id=, me=0xd99d80, recv=14165040)
at vm_insnhelper.c:524
#8 0x00007ffff7f41678 in vm_exec_core (th=, initial=)
at insns.def:1006
#9 0x00007ffff7f4756d in vm_exec (th=0x6030d0) at vm.c:1147
#10 0x00007ffff7f4c697 in vm_yield (th=, argv=0x0, argc=0) at vm.c:588