DVB-CI: don't call proto_tree_add_subtree_format() with tvb==NULL

When I first implemented this, proto_tree_add_subtree_format() worked
for tvb==NULL if len was also 0. The bounds check added in
56706427f5 breaks this use case and makes
DVB-CI spill out dissector asserts.

Warn Dissector bug, protocol DVB-CI, in packet 625:
../epan/tvbuff.c:532: failed assertion "tvb && tvb->initialized"

Create a proto_item first and link the subtree to this item. This will
work as long as proto_tree_add_uint() accepts tvb==NULL.

Thanks to Kay Katzorke for reporting this bug.

Change-Id: I25a071c21925f7d362c92852fd5a8136e4d361c8
Reviewed-on: https://code.wireshark.org/review/19389
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
This commit is contained in:
Martin Kaiser 2016-12-22 22:16:43 +01:00
parent abe78e915e
commit 933a731777
1 changed files with 10 additions and 4 deletions

View File

@ -921,6 +921,7 @@ static int hf_dvbci_spdu_tag = -1;
static int hf_dvbci_sess_status = -1;
static int hf_dvbci_sess_nb = -1;
static int hf_dvbci_close_sess_status = -1;
static int hf_dvbci_res_id = -1;
static int hf_dvbci_res_id_type = -1;
static int hf_dvbci_res_class = -1;
static int hf_dvbci_res_type = -1;
@ -2657,8 +2658,8 @@ static proto_item *
dissect_res_id(tvbuff_t *tvb, gint offset, packet_info *pinfo,
proto_tree *tree, guint32 res_id, gboolean show_col_info)
{
proto_item *ti = NULL;
proto_tree *res_tree = NULL;
proto_item *ti;
proto_tree *res_tree;
gint tvb_data_len;
/* there's two possible inputs for this function
@ -2689,8 +2690,9 @@ dissect_res_id(tvbuff_t *tvb, gint offset, packet_info *pinfo,
RES_VER(res_id));
}
res_tree = proto_tree_add_subtree_format(tree, tvb, offset, tvb_data_len,
ett_dvbci_res, &ti, "Resource ID: 0x%04x", res_id);
ti = proto_tree_add_uint(tree, hf_dvbci_res_id,
tvb, offset, tvb_data_len, res_id);
res_tree = proto_item_add_subtree(ti, ett_dvbci_res);
/* parameter "value" == complete resource id,
RES_..._MASK will be applied by the hf definition */
@ -5444,6 +5446,10 @@ proto_register_dvbci(void)
{ "Session Status", "dvb-ci.close_session_status",
FT_UINT8, BASE_HEX, VALS(dvbci_close_sess_status), 0, NULL, HFILL }
},
{ &hf_dvbci_res_id,
{ "Resource ID", "dvb-ci.res.id",
FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }
},
{ &hf_dvbci_res_id_type,
{ "Resource ID Type", "dvb-ci.res.id_type",
FT_UINT32, BASE_HEX, NULL, RES_ID_TYPE_MASK, NULL, HFILL }