diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2011-11-07 07:41:03 +0000 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2011-11-07 07:41:03 +0000 |
commit | 43c34aaf8ea3c5ee02fc6b278ee7badc074b81a4 (patch) | |
tree | bf84acbf6ec165d45b5152f41df9e0fc40b37f9e /epan | |
parent | 3f6175ac2ff3853ccb675a0afe32b81877dbcc24 (diff) |
Do not return from within a TRY/CATCH/ENDTRY because this will make the
except stack invalid, and will lead to a crash.
In this case it was when calling a dissector from a table in a Lua script.
svn path=/trunk/; revision=39748
Diffstat (limited to 'epan')
-rw-r--r-- | epan/wslua/wslua_proto.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/epan/wslua/wslua_proto.c b/epan/wslua/wslua_proto.c index 4e8447ce72..d95b5b7500 100644 --- a/epan/wslua/wslua_proto.c +++ b/epan/wslua/wslua_proto.c @@ -1699,6 +1699,7 @@ WSLUA_METHOD DissectorTable_try (lua_State *L) { Pinfo pinfo = checkPinfo(L,4); TreeItem ti = checkTreeItem(L,5); ftenum_t type; + gboolean handled = FALSE; gchar *volatile error = NULL; if (! (dt && tvb && tvb->ws_tvb && pinfo && ti) ) return 0; @@ -1710,22 +1711,24 @@ WSLUA_METHOD DissectorTable_try (lua_State *L) { if (type == FT_STRING) { const gchar* pattern = luaL_checkstring(L,2); - if (!pattern) return 0; + if (!pattern) + handled = TRUE; - if (dissector_try_string(dt->table,pattern,tvb->ws_tvb,pinfo->ws_pinfo,ti->tree)) - return 0; + else if (dissector_try_string(dt->table,pattern,tvb->ws_tvb,pinfo->ws_pinfo,ti->tree)) + handled = TRUE; } else if ( type == FT_UINT32 || type == FT_UINT16 || type == FT_UINT8 || type == FT_UINT24 ) { - int port = luaL_checkint(L, 2); + int port = luaL_checkint(L, 2); - if (dissector_try_uint(dt->table,port,tvb->ws_tvb,pinfo->ws_pinfo,ti->tree)) - return 0; + if (dissector_try_uint(dt->table,port,tvb->ws_tvb,pinfo->ws_pinfo,ti->tree)) + handled = TRUE; } else { - luaL_error(L,"No such type of dissector_table"); + luaL_error(L,"No such type of dissector_table"); } - call_dissector(lua_data_handle,tvb->ws_tvb,pinfo->ws_pinfo,ti->tree); + if (!handled) + call_dissector(lua_data_handle,tvb->ws_tvb,pinfo->ws_pinfo,ti->tree); /* XXX Are we sure about this??? is this the right/only thing to catch */ } CATCH(ReportedBoundsError) { |