From f59ea5f7690c9a01ef6f7f6508084a66c40b1dae Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 26 Apr 2024 19:44:25 +0200 Subject: Merging upstream version 4.2.4. Signed-off-by: Daniel Baumann --- epan/packet.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'epan/packet.c') diff --git a/epan/packet.c b/epan/packet.c index c4bcb4d8..5a4c70a1 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -880,13 +880,6 @@ static int call_dissector_work_error(dissector_handle_t handle, tvbuff_t *tvb, packet_info *pinfo_arg, proto_tree *tree, void *); -/* - * XXX packet_info.curr_layer_num is a guint8 and *_MAX_RECURSION_DEPTH is - * 100 elsewhere in the code. We should arguably use the same value here, - * but using that makes suite_wslua.case_wslua.test_wslua_dissector_fpm fail. - */ -#define PINFO_LAYER_MAX_RECURSION_DEPTH 500 - static int call_dissector_work(dissector_handle_t handle, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean add_proto_name, void *data) @@ -908,7 +901,7 @@ call_dissector_work(dissector_handle_t handle, tvbuff_t *tvb, packet_info *pinfo saved_proto = pinfo->current_proto; saved_can_desegment = pinfo->can_desegment; saved_layers_len = wmem_list_count(pinfo->layers); - DISSECTOR_ASSERT(saved_layers_len < PINFO_LAYER_MAX_RECURSION_DEPTH); + DISSECTOR_ASSERT(saved_layers_len < prefs.gui_max_tree_depth); /* * can_desegment is set to 2 by anyone which offers the @@ -2942,7 +2935,7 @@ dissector_try_heuristic(heur_dissector_list_t sub_dissectors, tvbuff_t *tvb, saved_layers_len = wmem_list_count(pinfo->layers); *heur_dtbl_entry = NULL; - DISSECTOR_ASSERT(saved_layers_len < PINFO_LAYER_MAX_RECURSION_DEPTH); + DISSECTOR_ASSERT(saved_layers_len < prefs.gui_max_tree_depth); for (entry = sub_dissectors->dissectors; entry != NULL; entry = g_slist_next(entry)) { @@ -3917,6 +3910,18 @@ prime_epan_dissect_with_postdissector_wanted_hfids(epan_dissect_t *edt) } } +void +increment_dissection_depth(packet_info *pinfo) { + pinfo->dissection_depth++; + DISSECTOR_ASSERT(pinfo->dissection_depth < (int)prefs.gui_max_tree_depth); +} + +void +decrement_dissection_depth(packet_info *pinfo) { + pinfo->dissection_depth--; + DISSECTOR_ASSERT(pinfo->dissection_depth >= 0); +} + /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * -- cgit v1.2.3