diff options
author | ulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7> | 2005-06-10 18:28:22 +0000 |
---|---|---|
committer | ulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7> | 2005-06-10 18:28:22 +0000 |
commit | bdcce227e42ad0bfbef2f7ed1a5503db812b9dc0 (patch) | |
tree | e65858f3d7c94418724c01ed7fcaf69e7272738f /epan/dissectors | |
parent | 577d2336bf389b6b2bdd6dee5a357ef3d5c66dcb (diff) |
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.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@14608 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors')
34 files changed, 75 insertions, 76 deletions
diff --git a/epan/dissectors/packet-bittorrent.c b/epan/dissectors/packet-bittorrent.c index 1bf7c97760..a544a354e8 100644 --- a/epan/dissectors/packet-bittorrent.c +++ b/epan/dissectors/packet-bittorrent.c @@ -223,7 +223,7 @@ static gboolean test_bittorrent_packet (tvbuff_t *tvb, packet_info *pinfo, conversation = conversation_new (pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - g_assert(find_dissector("bittorrent")); + DISSECTOR_ASSERT(find_dissector("bittorrent")); conversation_set_dissector(conversation, find_dissector("bittorrent")); diff --git a/epan/dissectors/packet-bssgp.c b/epan/dissectors/packet-bssgp.c index 25b00ec0e3..707a6aa0bf 100644 --- a/epan/dissectors/packet-bssgp.c +++ b/epan/dissectors/packet-bssgp.c @@ -467,7 +467,7 @@ get_bit_field_label(guint16 value, guint16 value_mask, guint16 num_bits) { guint16 i, bit_mask; static char label[MAX_NUM_BITS + 1]; - g_assert(num_bits <= MAX_NUM_BITS); + DISSECTOR_ASSERT(num_bits <= MAX_NUM_BITS); for (i = 0; i < num_bits; i++) { bit_mask = (guint16)pow(2, i); if (value_mask & bit_mask) { @@ -563,7 +563,7 @@ make_mask(guint8 num_bits, guint8 shift_value) { case 6: mask = 0xfc00; break; case 7: mask = 0xfe00; break; case 8: mask = 0xff00; break; - default: g_assert_not_reached(); mask = 0; break; + default: DISSECTOR_ASSERT_NOT_REACHED(); mask = 0; break; } return mask >> shift_value; } @@ -599,7 +599,7 @@ bit_proto_tree_add_bit_field8(proto_tree *tree, tvbuff_t *tvb, int i; proto_item *pi; - g_assert(bl < 9); + DISSECTOR_ASSERT(bl < 9); if (get_num_octets_spanned(bo, bl) == 1) { end_i = 7; @@ -1096,7 +1096,7 @@ translate_msrac_extended_dtm_gprs_multislot_class(guint8 value, guint8 dgmsc) { return "Unused, interpreted as Multislot class 5 supported"; } } - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); return "Error"; /* Dummy */ } @@ -1193,7 +1193,7 @@ translate_msrac_high_multislot_capability(guint8 capability, guint8 class) { return class; } } - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); return 0; } #endif @@ -1206,7 +1206,7 @@ translate_channel_needed(guint8 value) { case 2: return "TCH/F (Full rate)"; case 3: return "TCH/H or TCH/F (Dual rate)"; } - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); return NULL; } @@ -1345,7 +1345,7 @@ decode_mobile_identity(bssgp_ie_t *ie, build_info_t *bi, int ie_start_offset) { hf_id = hf_bssgp_imeisv; break; default: - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); hf_id = -1; break; } diff --git a/epan/dissectors/packet-cops.c b/epan/dissectors/packet-cops.c index 75e4cb54e9..8e14c82ed8 100644 --- a/epan/dissectors/packet-cops.c +++ b/epan/dissectors/packet-cops.c @@ -1573,7 +1573,7 @@ static int decode_cops_pr_asn1_data(tvbuff_t *tvb, guint32 offset, break; default: - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); return ASN1_ERR_WRONG_TYPE; } diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c index 5cc8f2b8ab..0dfa141cd9 100644 --- a/epan/dissectors/packet-dcerpc.c +++ b/epan/dissectors/packet-dcerpc.c @@ -1709,7 +1709,7 @@ dissect_deferred_pointers(packet_info *pinfo, tvbuff_t *tvb, int offset, guint8 old_offset = offset; offset = (*(fnct))(tvb, offset, pinfo, NULL, drep); - g_assert((offset-old_offset)==di->conformant_eaten); + DISSECTOR_ASSERT((offset-old_offset)==di->conformant_eaten); /* This is to check for any bugs in the dissectors. * * Basically, the NDR representation will store all @@ -3152,7 +3152,6 @@ end_cn_stub: } else { /* Reassembly not complete - some fragments are missing. Just show the stub data. */ - if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, " [DCE/RPC %s fragment]", fragment_type(hdr->flags)); diff --git a/epan/dissectors/packet-dcm.c b/epan/dissectors/packet-dcm.c index 20bf861bb0..12bbc19b43 100644 --- a/epan/dissectors/packet-dcm.c +++ b/epan/dissectors/packet-dcm.c @@ -538,8 +538,8 @@ dcm_tag2str(guint16 grp, guint16 elm, guint8 syntax, tvbuff_t *tvb, int offset, if (NULL == (dtag = g_hash_table_lookup(dcm_tagTable, GUINT_TO_POINTER(tag)))) dtag = &utag; + DISSECTOR_ASSERT(sizeof(buf) > strlen(dtag->desc)); strcpy(buf, dtag->desc); - g_assert(sizeof(buf) >= strlen(buf)); pl = sizeof(buf) - strlen(buf); p = buf + strlen(buf); if (vr > 0) { diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c index d2737c0408..394ed7622f 100644 --- a/epan/dissectors/packet-dns.c +++ b/epan/dissectors/packet-dns.c @@ -904,7 +904,7 @@ compute_key_id(tvbuff_t *tvb, int offset, int size, guint8 algo) guint32 ac; guint8 c1, c2; - g_assert(size >= 4); + DISSECTOR_ASSERT(size >= 4); switch( algo ) { case DNS_ALGO_RSAMD5: diff --git a/epan/dissectors/packet-esis.c b/epan/dissectors/packet-esis.c index 8b623194a3..5dd67c4a67 100644 --- a/epan/dissectors/packet-esis.c +++ b/epan/dissectors/packet-esis.c @@ -352,7 +352,7 @@ dissect_esis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { default: cksum_status = NULL; - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); } proto_tree_add_uint_format( esis_tree, hf_esis_checksum, tvb, 7, 2, tmp_uint, "Checksum : 0x%x ( %s )", diff --git a/epan/dissectors/packet-gsm_sms_ud.c b/epan/dissectors/packet-gsm_sms_ud.c index 005cae0a11..138baa4b65 100644 --- a/epan/dissectors/packet-gsm_sms_ud.c +++ b/epan/dissectors/packet-gsm_sms_ud.c @@ -632,7 +632,7 @@ proto_reg_handoff_gsm_sms_ud(void) proto_gsm_sms_ud); wsp_handle = find_dissector("wsp-cl"); - g_assert(wsp_handle); + DISSECTOR_ASSERT(wsp_handle); } diff --git a/epan/dissectors/packet-iax2.c b/epan/dissectors/packet-iax2.c index 36916d1bd3..c1ae493ff9 100644 --- a/epan/dissectors/packet-iax2.c +++ b/epan/dissectors/packet-iax2.c @@ -624,7 +624,7 @@ static iax_call_data *iax_lookup_circuit_details_from_dest( guint src_circuit_id /* there's no way we can create a CT_IAX2 circuit without adding iax call data to it; assert this */ - g_assert(iax_call); + DISSECTOR_ASSERT(iax_call); if( dst_circuit_id == iax_call -> forward_circuit_id ) { #ifdef DEBUG_HASHING @@ -691,7 +691,7 @@ static iax_call_data *iax_lookup_circuit_details_from_dest( guint src_circuit_id return NULL; } } else { - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); } @@ -702,7 +702,7 @@ static iax_call_data *iax_lookup_circuit_details_from_dest( guint src_circuit_id *circuit_p = find_circuit( CT_IAX2, src_circuit_id, framenum ); - g_assert(*circuit_p); + DISSECTOR_ASSERT(*circuit_p); } if( reversed_p ) @@ -764,7 +764,7 @@ static iax_call_data *iax_lookup_circuit_details( packet_info *pinfo, /* there's no way we can create a CT_IAX2 circuit without adding iax call data to it; assert this */ - g_assert(iax_call); + DISSECTOR_ASSERT(iax_call); if( src_circuit_id == iax_call -> forward_circuit_id ) reversed = FALSE; @@ -775,7 +775,7 @@ static iax_call_data *iax_lookup_circuit_details( packet_info *pinfo, without the circuit being either the forward or reverse circuit for that call; assert this too. */ - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); } } } diff --git a/epan/dissectors/packet-iscsi.c b/epan/dissectors/packet-iscsi.c index 11506cd17d..eaeea6995d 100644 --- a/epan/dissectors/packet-iscsi.c +++ b/epan/dissectors/packet-iscsi.c @@ -1931,7 +1931,7 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec /* here we should use some default */ break; default: - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); } } diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c index 5691de8b43..089086dae3 100644 --- a/epan/dissectors/packet-jxta.c +++ b/epan/dissectors/packet-jxta.c @@ -390,7 +390,7 @@ static int dissect_jxta_udp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); } - g_assert(find_dissector("jxta.udp")); + DISSECTOR_ASSERT(find_dissector("jxta.udp")); conversation_set_dissector(conversation, find_dissector("jxta.udp")); @@ -486,7 +486,7 @@ static int dissect_jxta_udp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr proto_item_set_end(jxta_udp_tree_item, tvb, tree_offset); - g_assert(offset == tree_offset); + DISSECTOR_ASSERT(offset == tree_offset); } /* FIXME Could be a partially filled in jxta_stream_conversation_data object */ @@ -959,7 +959,7 @@ static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, pro proto_item_set_end(framing_tree_item, tvb, tree_offset); - g_assert(offset == tree_offset); + DISSECTOR_ASSERT(offset == tree_offset); } /* return how many bytes we used up. */ @@ -1150,7 +1150,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree proto_item_set_end(jxta_msg_tree_item, tvb, tree_offset); - g_assert(tree_offset == offset); + DISSECTOR_ASSERT(tree_offset == offset); } if ((offset > 0) && (AT_STRINGZ == pinfo->src.type) && (AT_STRINGZ == pinfo->dst.type)) { @@ -1440,7 +1440,7 @@ static int dissect_jxta_message_element(tvbuff_t * tvb, packet_info * pinfo, pro proto_item_set_end(jxta_elem_tree_item, tvb, tree_offset); - g_assert(tree_offset == offset); + DISSECTOR_ASSERT(tree_offset == offset); } return offset; diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c index cb359030ef..2aa9538214 100644 --- a/epan/dissectors/packet-ldap.c +++ b/epan/dissectors/packet-ldap.c @@ -1122,8 +1122,8 @@ static void dissect_ldap_request_bind(ASN1_SCK *a, proto_tree *tree, } available_length = tvb_length_remaining(tvb, token_offset); reported_length = tvb_reported_length_remaining(tvb, token_offset); - g_assert(available_length >= 0); - g_assert(reported_length >= 0); + DISSECTOR_ASSERT(available_length >= 0); + DISSECTOR_ASSERT(reported_length >= 0); if (available_length > reported_length) available_length = reported_length; if ((guint)available_length > length) @@ -1154,8 +1154,8 @@ static void dissect_ldap_request_bind(ASN1_SCK *a, proto_tree *tree, } available_length = tvb_length_remaining(tvb, token_offset); reported_length = tvb_reported_length_remaining(tvb, token_offset); - g_assert(available_length >= 0); - g_assert(reported_length >= 0); + DISSECTOR_ASSERT(available_length >= 0); + DISSECTOR_ASSERT(reported_length >= 0); if (available_length > reported_length) available_length = reported_length; if ((guint)available_length > length) @@ -1241,8 +1241,8 @@ static void dissect_ldap_response_bind(ASN1_SCK *a, proto_tree *tree, } available_length = tvb_length_remaining(tvb, token_offset); reported_length = tvb_reported_length_remaining(tvb, token_offset); - g_assert(available_length >= 0); - g_assert(reported_length >= 0); + DISSECTOR_ASSERT(available_length >= 0); + DISSECTOR_ASSERT(reported_length >= 0); if (available_length > reported_length) available_length = reported_length; if ((guint)available_length > cred_length) @@ -1270,8 +1270,8 @@ static void dissect_ldap_response_bind(ASN1_SCK *a, proto_tree *tree, } available_length = tvb_length_remaining(tvb, token_offset); reported_length = tvb_reported_length_remaining(tvb, token_offset); - g_assert(available_length >= 0); - g_assert(reported_length >= 0); + DISSECTOR_ASSERT(available_length >= 0); + DISSECTOR_ASSERT(reported_length >= 0); if (available_length > reported_length) available_length = reported_length; if ((guint)available_length > cred_length) diff --git a/epan/dissectors/packet-msdp.c b/epan/dissectors/packet-msdp.c index cb15ca0c3d..dc0234356b 100644 --- a/epan/dissectors/packet-msdp.c +++ b/epan/dissectors/packet-msdp.c @@ -313,8 +313,8 @@ static void dissect_msdp_sa(tvbuff_t *tvb, packet_info *pinfo, available_length = tvb_length_remaining(tvb, *offset); reported_length = tvb_reported_length_remaining(tvb, *offset); - g_assert(available_length >= 0); - g_assert(reported_length >= 0); + DISSECTOR_ASSERT(available_length >= 0); + DISSECTOR_ASSERT(reported_length >= 0); if (available_length > reported_length) available_length = reported_length; if (available_length > length) diff --git a/epan/dissectors/packet-msproxy.c b/epan/dissectors/packet-msproxy.c index c69edf9e68..2b0c2d0fc9 100644 --- a/epan/dissectors/packet-msproxy.c +++ b/epan/dissectors/packet-msproxy.c @@ -206,7 +206,7 @@ static void msproxy_sub_dissector( tvbuff_t *tvb, packet_info *pinfo, conversation = find_conversation( pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - g_assert( conversation); /* should always find a conversation */ + DISSECTOR_ASSERT( conversation); /* should always find a conversation */ redirect_info = conversation_get_proto_data(conversation, proto_msproxy); diff --git a/epan/dissectors/packet-mtp3.c b/epan/dissectors/packet-mtp3.c index c9f2d1fe2b..7c196c3a92 100644 --- a/epan/dissectors/packet-mtp3.c +++ b/epan/dissectors/packet-mtp3.c @@ -212,7 +212,7 @@ mtp3_pc_to_str_buf(const guint32 pc, gchar *buf) sprintf(buf, "%u-%u-%u-%u", (pc & 0x3c00) >>10, (pc & 0x0380) >> 7, (pc & 0x0078) >> 3, (pc & 0x0007) >> 0); break; default: - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); } break; case ANSI_STANDARD: @@ -220,7 +220,7 @@ mtp3_pc_to_str_buf(const guint32 pc, gchar *buf) sprintf(buf, "%u-%u-%u", (pc & ANSI_NETWORK_MASK), (pc & ANSI_CLUSTER_MASK) >> 8, (pc & ANSI_MEMBER_MASK) >> 16); break; default: - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); } } diff --git a/epan/dissectors/packet-ncp2222.inc b/epan/dissectors/packet-ncp2222.inc index 35f0c74507..7641a0a9de 100644 --- a/epan/dissectors/packet-ncp2222.inc +++ b/epan/dissectors/packet-ncp2222.inc @@ -1225,7 +1225,7 @@ process_bitfield_sub_ptvc_record(ptvcursor_t *ptvc, const ptvc_record *rec, /* Use it */ sub_rec = rec->sub_ptvc_rec->ptvc_rec; while(sub_rec->hf_ptr != NULL) { - g_assert(!sub_rec->sub_ptvc_rec); + DISSECTOR_ASSERT(!sub_rec->sub_ptvc_rec); ptvcursor_add_no_advance(sub_ptvc, *sub_rec->hf_ptr, sub_rec->length, sub_rec->endianness); sub_rec++; @@ -1334,7 +1334,7 @@ _process_ptvc_record(ptvcursor_t *ptvc, const ptvc_record *rec, func = padd_uni; break; default: - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); } item = func(ptvc, rec); @@ -1349,7 +1349,7 @@ _process_ptvc_record(ptvcursor_t *ptvc, const ptvc_record *rec, * Actually, we could, as long as we don't * *use* that var; for now keep this assert in * place. */ - g_assert(rec->var_index == NO_VAR); + DISSECTOR_ASSERT(rec->var_index == NO_VAR); ptvcursor_advance(ptvc, rec->length); } } @@ -1372,7 +1372,7 @@ _process_ptvc_record(ptvcursor_t *ptvc, const ptvc_record *rec, func = padd_uni; break; default: - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); } for (i = 0; i < repeat_count; i++ ) { func(ptvc, rec); @@ -4327,7 +4327,7 @@ nds_defrag(tvbuff_t *tvb, packet_info *pinfo, guint16 nw_connection, guint8 sequ if (frags[i].nds_frag == 0xffffffff) { /* Error can't find fragment */ - /*g_assert(0);*/ + /*DISSECTOR_ASSERT(0);*/ } frag_count = i; /* Remember this fragment information so we can dissect. diff --git a/epan/dissectors/packet-ospf.c b/epan/dissectors/packet-ospf.c index aac76eba9b..f0fc89877e 100644 --- a/epan/dissectors/packet-ospf.c +++ b/epan/dissectors/packet-ospf.c @@ -568,7 +568,7 @@ dissect_ospf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; default: - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); cksum_vec_len = 0; break; } diff --git a/epan/dissectors/packet-pim.c b/epan/dissectors/packet-pim.c index 5ba376cba6..1aad390066 100644 --- a/epan/dissectors/packet-pim.c +++ b/epan/dissectors/packet-pim.c @@ -709,7 +709,7 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { default: /* PIM is available for IPv4 and IPv6 right now */ computed_cksum = 0; /* squelch GCC complaints */ - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); break; } diff --git a/epan/dissectors/packet-ppp.c b/epan/dissectors/packet-ppp.c index ec019f5332..5097181439 100644 --- a/epan/dissectors/packet-ppp.c +++ b/epan/dissectors/packet-ppp.c @@ -1584,7 +1584,7 @@ decode_fcs(tvbuff_t *tvb, proto_tree *fh_tree, int fcs_decode, int proto_offset) break; default: - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); next_tvb = NULL; } diff --git a/epan/dissectors/packet-pppoe.c b/epan/dissectors/packet-pppoe.c index d1f33240fc..9ab20c93d4 100644 --- a/epan/dissectors/packet-pppoe.c +++ b/epan/dissectors/packet-pppoe.c @@ -276,8 +276,8 @@ dissect_pppoes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { */ length = tvb_length_remaining(tvb, 6); reported_length = tvb_reported_length_remaining(tvb, 6); - 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 ((guint)length > pppoe_length) diff --git a/epan/dissectors/packet-radius.c b/epan/dissectors/packet-radius.c index 7249d73b3d..ab7c7bcbab 100644 --- a/epan/dissectors/packet-radius.c +++ b/epan/dissectors/packet-radius.c @@ -3433,7 +3433,7 @@ rdconvertbufftostr(gchar *dest, tvbuff_t *tvb, int offset, int length) int totlen=0; const guint8 *pd; - g_assert(length >= 0); + DISSECTOR_ASSERT(length >= 0); pd = tvb_get_ptr(tvb, offset, length); dest[0]='"'; dest[1]=0; @@ -3464,7 +3464,7 @@ rdconvertbufftobinstr(gchar *dest, tvbuff_t *tvb, int offset, int length) static const char hex[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; - g_assert(length >= 0); + DISSECTOR_ASSERT(length >= 0); pd = tvb_get_ptr(tvb, offset, length); for (i=0; i < length; i++) { @@ -4039,7 +4039,7 @@ static void rd_value_to_str(gchar *dest, rd_vsa_buffer (*vsabuffer)[VSABUFFER], break; default: - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); } cont=&cont[strlen(cont)]; if (cont == dest) { 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; } } diff --git a/epan/dissectors/packet-rtsp.c b/epan/dissectors/packet-rtsp.c index cc6a89a2bb..554f9ffb79 100644 --- a/epan/dissectors/packet-rtsp.c +++ b/epan/dissectors/packet-rtsp.c @@ -1078,7 +1078,7 @@ process_rtsp_request(tvbuff_t *tvb, int offset, const guchar *data, * RTSP_REQUEST, so we know one of the request methods * matched, so we "can't get here". */ - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); } /* Method name */ diff --git a/epan/dissectors/packet-smb-pipe.c b/epan/dissectors/packet-smb-pipe.c index ad59b54d99..c751317f83 100644 --- a/epan/dissectors/packet-smb-pipe.c +++ b/epan/dissectors/packet-smb-pipe.c @@ -2693,7 +2693,7 @@ dissect_pipe_lanman(tvbuff_t *pd_tvb, tvbuff_t *p_tvb, tvbuff_t *d_tvb, /* * Save the parameter descriptor for future use. */ - g_assert(trp->param_descrip == NULL); + DISSECTOR_ASSERT(trp->param_descrip == NULL); trp->param_descrip = g_strdup(param_descrip); } offset += descriptor_len; @@ -2707,7 +2707,7 @@ dissect_pipe_lanman(tvbuff_t *pd_tvb, tvbuff_t *p_tvb, tvbuff_t *d_tvb, /* * Save the return descriptor for future use. */ - g_assert(trp->data_descrip == NULL); + DISSECTOR_ASSERT(trp->data_descrip == NULL); trp->data_descrip = g_strdup(data_descrip); } offset += descriptor_len; @@ -2734,7 +2734,7 @@ dissect_pipe_lanman(tvbuff_t *pd_tvb, tvbuff_t *p_tvb, tvbuff_t *d_tvb, * Save the auxiliary data descriptor for * future use. */ - g_assert(trp->aux_data_descrip == NULL); + DISSECTOR_ASSERT(trp->aux_data_descrip == NULL); trp->aux_data_descrip = g_strdup(aux_data_descrip); } diff --git a/epan/dissectors/packet-smpp.c b/epan/dissectors/packet-smpp.c index d2f3d565ec..5bd2643156 100644 --- a/epan/dissectors/packet-smpp.c +++ b/epan/dissectors/packet-smpp.c @@ -2762,5 +2762,5 @@ proto_reg_handoff_smpp(void) /* Required for call_dissector() */ DebugLog(("Finding gsm-sms-ud subdissector\n")); gsm_sms_handle = find_dissector("gsm-sms-ud"); - g_assert (gsm_sms_handle); + DISSECTOR_ASSERT(gsm_sms_handle); } diff --git a/epan/dissectors/packet-sna.c b/epan/dissectors/packet-sna.c index 7d589e2a08..bc12508de4 100644 --- a/epan/dissectors/packet-sna.c +++ b/epan/dissectors/packet-sna.c @@ -1688,7 +1688,7 @@ defragment_by_sequence(packet_info *pinfo, tvbuff_t *tvb, int offset, int mpf, more_frags = FALSE; break; default: - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); } /* If sna_defragment is on, and this is a fragment.. */ diff --git a/epan/dissectors/packet-snmp.c b/epan/dissectors/packet-snmp.c index 2364bf3fa6..af0483d2ca 100644 --- a/epan/dissectors/packet-snmp.c +++ b/epan/dissectors/packet-snmp.c @@ -1016,7 +1016,7 @@ snmp_variable_decode(proto_tree *snmp_tree, break; default: - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); return ASN1_ERR_WRONG_TYPE; } *lengthp = length; diff --git a/epan/dissectors/packet-socks.c b/epan/dissectors/packet-socks.c index 3d7e04ffe9..d0b12afcbc 100644 --- a/epan/dissectors/packet-socks.c +++ b/epan/dissectors/packet-socks.c @@ -379,7 +379,7 @@ socks_udp_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { conversation = find_conversation( pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - g_assert( conversation); /* should always find a conversation */ + DISSECTOR_ASSERT( conversation); /* should always find a conversation */ hash_info = conversation_get_proto_data(conversation, proto_socks); @@ -438,7 +438,7 @@ new_udp_conversation( socks_hash_entry_t *hash_info, packet_info *pinfo){ conversation_t *conversation = conversation_new( pinfo->fd->num, &pinfo->src, &pinfo->dst, PT_UDP, hash_info->udp_port, hash_info->port, 0); - g_assert( conversation); + DISSECTOR_ASSERT( conversation); conversation_add_proto_data(conversation, proto_socks, hash_info); conversation_set_dissector(conversation, socks_udp_handle); diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index f7faf7eed1..03e392e87e 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -2933,7 +2933,7 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) default: /* TCP runs only atop IPv4 and IPv6.... */ - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); break; } cksum_vec[3].ptr = tvb_get_ptr(tvb, offset, reported_len); diff --git a/epan/dissectors/packet-udp.c b/epan/dissectors/packet-udp.c index afd5661467..98be190a26 100644 --- a/epan/dissectors/packet-udp.c +++ b/epan/dissectors/packet-udp.c @@ -248,8 +248,8 @@ dissect_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; default: - /* TCP runs only atop IPv4 and IPv6.... */ - g_assert_not_reached(); + /* UDP runs only atop IPv4 and IPv6.... */ + DISSECTOR_ASSERT_NOT_REACHED(); break; } cksum_vec[3].ptr = tvb_get_ptr(tvb, offset, udph->uh_ulen); diff --git a/epan/dissectors/packet-vj.c b/epan/dissectors/packet-vj.c index 9bd3e3d677..773f19e3ed 100644 --- a/epan/dissectors/packet-vj.c +++ b/epan/dissectors/packet-vj.c @@ -576,7 +576,7 @@ vjc_tvb_setup(tvbuff_t *src_tvb, gint buf_len; guint8 *pbuf; - g_assert(src_tvb); + DISSECTOR_ASSERT(src_tvb); /* Get decompressed header stored in fd protocol area */ hdr_buf = p_get_proto_data(pinfo->fd, proto_vj); diff --git a/epan/dissectors/packet-wbxml.c b/epan/dissectors/packet-wbxml.c index 88ad58fefe..cfa30377cd 100644 --- a/epan/dissectors/packet-wbxml.c +++ b/epan/dissectors/packet-wbxml.c @@ -5098,7 +5098,7 @@ dissect_wbxml_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, default: /* Impossible since we returned already earlier */ g_error("%s:%u: WBXML version octet 0x%02X only partly supported!\n" "Please report this as a bug.\n", __FILE__, __LINE__, version); - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); break; } diff --git a/epan/dissectors/packet-wcp.c b/epan/dissectors/packet-wcp.c index c46afafd31..a3fd2fe68f 100644 --- a/epan/dissectors/packet-wcp.c +++ b/epan/dissectors/packet-wcp.c @@ -598,7 +598,7 @@ static tvbuff_t *wcp_uncompress( tvbuff_t *src_tvb, int offset, packet_info *pin } CATCH(BoundsError) { - g_assert_not_reached(); + DISSECTOR_ASSERT_NOT_REACHED(); g_free(buf); return NULL; } diff --git a/epan/dissectors/packet-x11.c b/epan/dissectors/packet-x11.c index f6d877e3c9..4434dc4896 100644 --- a/epan/dissectors/packet-x11.c +++ b/epan/dissectors/packet-x11.c @@ -1826,8 +1826,8 @@ static void listOfKeysyms(tvbuff_t *tvb, int *offsetp, proto_tree *t, int hf, proto_tree *ttt; int i, keycode; - g_assert(keycode_first >= 0); - g_assert(keycode_count >= 0); + DISSECTOR_ASSERT(keycode_first >= 0); + DISSECTOR_ASSERT(keycode_count >= 0); for (keycode = keycode_first; keycode_count > 0; ++keycode, --keycode_count) { |