From fdb5b1af02573c18ed69561b5df37c28d52745c1 Mon Sep 17 00:00:00 2001 From: Ulf Lamping Date: Fri, 10 Jun 2005 18:28:22 +0000 Subject: just to get things straight: a dissector should *never* do any g_assert() calls! in a simple approach, I've replaced all g_assert() and g_assert_not_reached() calls by their exception throwing counterparts DISSECTOR_ASSERT() and DISSECTOR_ASSERT_NOT_REACHED() this will replace application crash by showing a dissector bug, which is the desired behaviour there were some g_assert calls in the protocol registering functions, which might not be acting as expected now, but to be able to simply search for g_assert in the future I've replaced that calls too one g_assert remained, the one when someone throws an unknown exception "into" packet_frame.c, but IMHO this one should remain. svn path=/trunk/; revision=14608 --- epan/dissectors/packet-rpc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'epan/dissectors/packet-rpc.c') diff --git a/epan/dissectors/packet-rpc.c b/epan/dissectors/packet-rpc.c index c92763eeef..2a19b3e9a0 100644 --- a/epan/dissectors/packet-rpc.c +++ b/epan/dissectors/packet-rpc.c @@ -307,7 +307,7 @@ rpc_init_proc_table(guint prog, guint vers, const vsff *proc_table, */ rpc_prog_key.prog = prog; rpc_prog = g_hash_table_lookup(rpc_progs, &rpc_prog_key); - g_assert(rpc_prog != NULL); + DISSECTOR_ASSERT(rpc_prog != NULL); rpc_prog->procedure_hfs = g_array_set_size(rpc_prog->procedure_hfs, vers); g_array_insert_val(rpc_prog->procedure_hfs, vers, procedure_hf); @@ -514,7 +514,7 @@ int hfindex, int offset) header_field_info *hfinfo; hfinfo = proto_registrar_get_nth(hfindex); - g_assert(hfinfo->type == FT_UINT64); + DISSECTOR_ASSERT(hfinfo->type == FT_UINT64); if (tree) proto_tree_add_item(tree, hfindex, tvb, offset, 8, FALSE); @@ -1069,8 +1069,8 @@ dissect_rpc_authgss_token(tvbuff_t* tvb, proto_tree* tree, int offset, offset += 4; length = tvb_length_remaining(tvb, offset); reported_length = tvb_reported_length_remaining(tvb, offset); - g_assert(length >= 0); - g_assert(reported_length >= 0); + DISSECTOR_ASSERT(length >= 0); + DISSECTOR_ASSERT(reported_length >= 0); if (length > reported_length) length = reported_length; if ((guint32)length > opaque_length) @@ -2378,7 +2378,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, * The switch statement at the top returned if * this was neither an RPC call nor a reply. */ - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); } /* now we know, that RPC was shorter */ @@ -3002,7 +3002,7 @@ dissect_rpc_fragment(tvbuff_t *tvb, int offset, packet_info *pinfo, * we've seen, and the "last fragment" bit wasn't * set on it. */ - g_assert(ipfd_head == NULL); + DISSECTOR_ASSERT(ipfd_head == NULL); new_rfk = g_mem_chunk_alloc(rpc_fragment_key_chunk); new_rfk->conv_id = rfk->conv_id; @@ -3231,7 +3231,7 @@ dissect_rpc_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) default: /* "Can't happen" */ - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); return FALSE; } } -- cgit v1.2.3