diff options
author | Luis Ontanon <luis.ontanon@gmail.com> | 2007-03-04 16:00:05 +0000 |
---|---|---|
committer | Luis Ontanon <luis.ontanon@gmail.com> | 2007-03-04 16:00:05 +0000 |
commit | 2688c9b3f3ce0b71ab8cc896f120ea2b82ed2611 (patch) | |
tree | 98457db9274a9922927adda712c47fd6215aefeb /epan | |
parent | 379a3e53ec9ca2626b045857e19f92250edf08e0 (diff) |
do not return before ENDTRY when handling an exception, this would leave the fat stack without the top and cause the dereferencing of a null pointer later on when popping in the next ENDTRY.
Oddly enough this shows up only on windows. Maybe there's something good in my Mac's temporary disability!
svn path=/trunk/; revision=20972
Diffstat (limited to 'epan')
-rw-r--r-- | epan/wslua/wslua.h | 2 | ||||
-rw-r--r-- | epan/wslua/wslua_proto.c | 17 |
2 files changed, 12 insertions, 7 deletions
diff --git a/epan/wslua/wslua.h b/epan/wslua/wslua.h index 481d87673b..ebef7d214c 100644 --- a/epan/wslua/wslua.h +++ b/epan/wslua/wslua.h @@ -276,7 +276,7 @@ int dummy##C #define WSLUA_META static const luaL_reg #define WSLUA_CLASS_FNREG(class,name) { #name, class##_##name } -#define WSLUA_ERROR(name,error) { luaL_error(L, #name ": " error); return 0; } +#define WSLUA_ERROR(name,error) { luaL_error(L, ep_strdup_printf("%s%s", #name ": " ,error) ); return 0; } #define WSLUA_ARG_ERROR(name,attr,error) { luaL_argerror(L,WSLUA_ARG_ ## name ## _ ## attr, #name ": " error); return 0; } #define WSLUA_OPTARG_ERROR(name,attr,error) { luaL_argerror(L,WSLUA_OPTARG_##name##_ ##attr, #name ": " error); return 0; } diff --git a/epan/wslua/wslua_proto.c b/epan/wslua/wslua_proto.c index 8fbb2b0bba..2275f77b9d 100644 --- a/epan/wslua/wslua_proto.c +++ b/epan/wslua/wslua_proto.c @@ -1160,7 +1160,8 @@ WSLUA_METHOD Dissector_call(lua_State* L) { Tvb tvb = checkTvb(L,WSLUA_ARG_Dissector_call_TVB); Pinfo pinfo = checkPinfo(L,WSLUA_ARG_Dissector_call_PINFO); TreeItem ti = checkTreeItem(L,WSLUA_ARG_Dissector_call_TREE); - + char* error = NULL; + if (! ( d && tvb && pinfo) ) return 0; TRY { @@ -1168,10 +1169,11 @@ WSLUA_METHOD Dissector_call(lua_State* L) { /* XXX Are we sure about this??? is this the right/only thing to catch */ } CATCH(ReportedBoundsError) { proto_tree_add_protocol_format(lua_tree->tree, lua_malformed, lua_tvb, 0, 0, "[Malformed Frame: Packet Length]" ); - WSLUA_ERROR(Dissector_call,"malformed frame"); - return 0; + error = "malformed frame"; } ENDTRY; - + + if (error) { WSLUA_ERROR(Dissector_call,error); } + return 0; } @@ -1360,7 +1362,8 @@ WSLUA_METHOD DissectorTable_try (lua_State *L) { Pinfo pinfo = checkPinfo(L,4); TreeItem ti = checkTreeItem(L,5); ftenum_t type; - + gchar* error = NULL; + if (! (dt && tvb && pinfo && ti) ) return 0; type = get_dissector_table_selector_type(dt->name); @@ -1390,9 +1393,11 @@ WSLUA_METHOD DissectorTable_try (lua_State *L) { /* XXX Are we sure about this??? is this the right/only thing to catch */ } CATCH(ReportedBoundsError) { proto_tree_add_protocol_format(lua_tree->tree, lua_malformed, lua_tvb, 0, 0, "[Malformed Frame: Packet Length]" ); - WSLUA_ERROR(DissectorTable_try,"malformed frame"); + error = "malformed frame"; } ENDTRY; + if (error) { WSLUA_ERROR(DissectorTable_try,error); } + return 0; } |