Comment 3 for bug 1136432

Revision history for this message
Alexey Brodkin (alexey-brodkin) wrote :

I also may confirm this issue with lua.
I faced it trying to play a video from public web-cam.
===================
$ gdb --args vlc http://83.64.164.6/mjpg/video.mjpg
GNU gdb (GDB) 7.5-ubuntu
Reading symbols from /usr/bin/vlc...Reading symbols from /usr/lib/debug/usr/bin/vlc...done.
done.
(gdb) run
Starting program: /usr/bin/vlc http://83.64.164.6/mjpg/video.mjpg
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
VLC media player 2.0.5 Twoflower (revision 2.0.5-0-g1661b7d)

Program received signal SIGSEGV, Segmentation fault.
0xb7b4425d in __GI___uflow (fp=0x80dc9c0) at genops.c:394
394 genops.c: No such file or directory.
(gdb) bt
#0 0xb7b4425d in __GI___uflow (fp=0x80dc9c0) at genops.c:394
#1 0xb7b3a772 in _IO_getc (fp=0x80dc9c0) at getc.c:41
#2 0xb4e4cd8c in luaL_loadfile (L=L@entry=0x81905a0,
    filename=filename@entry=0x81904e0 "/usr/lib/vlc/lua/meta/reader/filename.luac") at lauxlib.c:577
#3 0xb4e8c055 in run (p_this=p_this@entry=0x8188cc0,
    psz_filename=psz_filename@entry=0x81904e0 "/usr/lib/vlc/lua/meta/reader/filename.luac",
    L=L@entry=0x81905a0, luafunction=luafunction@entry=0xb4ea3f61 "read_meta") at meta.c:100
#4 0xb4e8c2a0 in read_meta (p_this=p_this@entry=0x8188cc0,
    psz_filename=0x81904e0 "/usr/lib/vlc/lua/meta/reader/filename.luac",
    user_data=user_data@entry=0x81c8dd8) at meta.c:192
#5 0xb4e8f689 in vlclua_scripts_batch_execute (p_this=p_this@entry=0x8188cc0,
    luadirname=luadirname@entry=0xb4ea3fa6 "meta/reader", func=func@entry=0xb4e8c250 <read_meta>,
    user_data=0x81c8dd8) at vlc.c:317
#6 0xb4e8c506 in ReadMeta (p_this=0x8188cc0) at meta.c:227
#7 0xb7d2c6a0 in generic_start (func=0xb4e8c4d0 <ReadMeta>, ap=0xbfffe2c8 "\350\342\377\277",
    ap@entry=0xbfffe2c4 "\300\214\030\b\350\342\377\277") at modules/modules.c:422
#8 0xb7d2cde3 in vlc_module_load (p_this=p_this@entry=0x8188cc0,
    psz_capability=psz_capability@entry=0xb7d7067f "meta reader", psz_name=<optimized out>,
    psz_name@entry=0x0, b_strict=b_strict@entry=false, probe=probe@entry=0xb7d2c690 <generic_start>)
    at modules/modules.c:347
#9 0xb7d2d302 in module_need (obj=obj@entry=0x8188cc0, cap=cap@entry=0xb7d7067f "meta reader",
    name=name@entry=0x0, strict=strict@entry=false) at modules/modules.c:437
#10 0xb7ce679b in InputSourceMeta (p_input=p_input@entry=0x80d7188, p_meta=p_meta@entry=0x818c8d0,
    p_source=<optimized out>, p_source=<optimized out>) at input/input.c:2741
#11 0xb7ce9b5d in Init (p_input=p_input@entry=0x80d7188) at input/input.c:1315
#12 0xb7cedd5b in input_Read (p_parent=p_parent@entry=0x818af40, p_item=p_item@entry=0x81c8dd8)
    at input/input.c:175
#13 0xb7cc6c05 in playlist_MLLoad (p_playlist=p_playlist@entry=0x818af40) at playlist/loadsave.c:171
#14 0xb7cc21a9 in playlist_Create (p_parent=p_parent@entry=0x804db78) at playlist/engine.c:271
#15 0xb7ca9fb5 in libvlc_InternalInit (p_libvlc=p_libvlc@entry=0x804db78, i_argc=4,
    ppsz_argv=ppsz_argv@entry=0xbfffe77c) at libvlc.c:557
#16 0xb7d9c1d8 in libvlc_new (argc=argc@entry=3, argv=argv@entry=0xbfffe7e4) at core.c:59
#17 0x08048f68 in main (i_argc=2, ppsz_argv=0xbfffea04) at vlc.c:217
===================

So from this back-trace I made an assumption that lua falls in segfault processing "/usr/lib/vlc/lua/meta/reader/filename.luac".
And indeed:
===================
$ gdb --args lua /usr/lib/vlc/lua/meta/reader/filename.luac
GNU gdb (GDB) 7.5-ubuntu
Reading symbols from /usr/bin/lua...Reading symbols from /usr/lib/debug/.build-id/fc/b9cc5f5115c7a1dab4b5544c40751cb9ecdf4b.debug...done.
done.
(gdb) run
Starting program: /usr/bin/lua /usr/lib/vlc/lua/meta/reader/filename.luac
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0xb7c1025d in __GI___uflow (fp=0x8078188) at genops.c:394
394 genops.c: No such file or directory.
(gdb) bt
#0 0xb7c1025d in __GI___uflow (fp=0x8078188) at genops.c:394
#1 0xb7c06772 in _IO_getc (fp=0x8078188) at getc.c:41
#2 0x0805a32c in luaL_loadfile (L=L@entry=0x8073278,
    filename=0xbfffec02 "/usr/lib/vlc/lua/meta/reader/filename.luac") at lauxlib.c:577
#3 0x0804ba47 in handle_script (n=<optimized out>, argv=<optimized out>, L=<optimized out>)
    at lua.c:247
#4 pmain (L=0x8073278) at lua.c:362
#5 0x0804f343 in luaD_precall (L=L@entry=0x8073278, func=<optimized out>, func@entry=0x80734ac,
    nresults=nresults@entry=0) at ldo.c:320
#6 0x0804f718 in luaD_call (L=L@entry=0x8073278, func=0x80734ac, nResults=nResults@entry=0)
    at ldo.c:377
#7 0x0804bbb8 in f_Ccall (L=L@entry=0x8073278, ud=ud@entry=0xbfffe928) at lapi.c:846
#8 0x0804ea74 in luaD_rawrunprotected (L=L@entry=0x8073278, f=f@entry=0x804bb40 <f_Ccall>,
    ud=ud@entry=0xbfffe928) at ldo.c:116
#9 0x0804f8ff in luaD_pcall (L=L@entry=0x8073278, func=func@entry=0x804bb40 <f_Ccall>,
    u=u@entry=0xbfffe928, old_top=12, ef=ef@entry=0) at ldo.c:464
#10 0x0804d151 in lua_cpcall (L=L@entry=0x8073278, func=func@entry=0x804b590 <pmain>,
    ud=ud@entry=0xbfffe954) at lapi.c:856
#11 0x0804ac9c in main (argc=2, argv=0xbfffea04) at lua.c:387
===================

So to reproduce this we need:
===================
1. Lua script (I'll attach it later as well): http://git.videolan.org/?p=vlc.git;a=blob_plain;f=share/lua/meta/reader/filename.lua;hb=HEAD
2. Compile script:
luac filename.lua
3. Run compiled lua script:
lua luac.out
===================

Also I noticed if lua-5.0 (/usr/bin/luac50) is used for compilation then lua-5.0 (/usr/bin/lua50) may as well correctly execute compiled script.

Lua 5.2 crashes the same way as 5.1 does.
===================
/usr/bin/lua5.2 -v
Lua 5.2.1 Copyright (C) 1994-2012 Lua.org, PUC-Rio
===================

So seems like regression introduced in 5.1 and still existing in 5.2.1