lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


i'm not sure if this is a bug in lua_getmetatable() (or luaL_checkudata() ?)
but if you call it with a non-valid index you get a SIGSEGV since 'obj' is
NULL.


gdbm> gdb -q lua
(gdb) run -lgdbm -i
Starting program: /usr/local/taj/bin/lua -lgdbm -i
> d=gdbm.open('foobar', 'n')
> d.close()		-- should be d:close() !!

Program received signal SIGSEGV, Segmentation fault.
lua_getmetatable (L=0x8063468, objindex=1) at lapi.c:528
528       switch (ttype(obj)) {
(gdb) bt
#0  lua_getmetatable (L=0x8063468, objindex=1) at lapi.c:528
#1  0x080596c1 in luaL_checkudata (L=0x8063468, ud=1, tname=0x40014731 "gdbm handle") at lauxlib.c:130
#2  0x400141aa in Lget (L=0x8063468, i=1) at lgdbm.c:82
#3  0x400142bf in Lclose (L=0x8063468) at lgdbm.c:121
#4  0x0804f528 in luaD_precall (L=0x8063468, func=0x8069278) at ldo.c:262
#5  0x0805688c in luaV_execute (L=0x8063468) at lvm.c:625
#6  0x0804f6e4 in luaD_call (L=0x8063468, func=0x806926c, nResults=-1) at ldo.c:315
#7  0x0804d776 in f_call (L=0x8063468, ud=0x0) at lapi.c:671
#8  0x0804ee94 in luaD_rawrunprotected (L=0x8063468, f=0x804d760 <f_call>, ud=0xbffff5e0) at ldo.c:88
#9  0x0804f996 in luaD_pcall (L=0x8063468, func=0x804d760 <f_call>, u=0xbffff5e0, old_top=24, ef=0) at ldo.c:405
#10 0x0804d7c0 in lua_pcall (L=0x8063468, nargs=0, nresults=0, errfunc=0) at lapi.c:684
#11 0x0804ba55 in lcall (narg=0, clear=0) at lua.c:137
#12 0x0804bfc8 in manual_input () at lua.c:288
#13 0x0804c2c8 in pmain (l=0x0) at lua.c:415
#14 0x0804f528 in luaD_precall (L=0x8063468, func=0x806357c) at ldo.c:262
#15 0x0804f69f in luaD_call (L=0x8063468, func=0x806357c, nResults=0) at ldo.c:313
#16 0x0804d84a in f_Ccall (L=0x8063468, ud=0xbffff830) at lapi.c:708
#17 0x0804ee94 in luaD_rawrunprotected (L=0x8063468, f=0x804d7e0 <f_Ccall>, ud=0xbffff830) at ldo.c:88
#18 0x0804f996 in luaD_pcall (L=0x8063468, func=0x804d7e0 <f_Ccall>, u=0xbffff830, old_top=-1073743692, ef=0) at ldo.c:405
#19 0x0804d8a9 in lua_cpcall (L=0xed, func=0, ud=0x0) at lapi.c:718
#20 0x0804c2fe in main (argc=0, argv=0xbffff8b4) at lua.c:432
(gdb) p obj
$1 = (struct lua_TObject *) 0x0


-taj