aboutsummaryrefslogtreecommitdiffstats
path: root/epan/proto.c
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss.ws@gmail.com>2012-12-02 03:34:06 +0000
committerJeff Morriss <jeff.morriss.ws@gmail.com>2012-12-02 03:34:06 +0000
commitda4442d6384b15530fd740295080a8ad3a145ca6 (patch)
treec2ff18ebc1535ae49cb1244a4354ea25f21908b7 /epan/proto.c
parent2403ef591da300f44c590743122e215fa1cd5949 (diff)
Use g_error() to generate an explanatory message (and a core) when
ABORT_ON_DISSECTOR_BUG is set and we pass MAX_TREE_ITEMS. If ABORT_ON_DISSECTOR_BUG is set and we get an unregistered hf, generate an explanatory message (and a core). svn path=/trunk/; revision=46323
Diffstat (limited to 'epan/proto.c')
-rw-r--r--epan/proto.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 07cc9480e7..c701d30182 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -106,7 +106,7 @@ wrs_count_bitshift(const guint32 bitmask)
PTREE_DATA(tree)->count++; \
if (PTREE_DATA(tree)->count > MAX_TREE_ITEMS) { \
if (getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL) \
- abort(); \
+ g_error("More than %d items in the tree -- possible infinite loop", MAX_TREE_ITEMS); \
/* Let the exception handler add items to the tree */ \
PTREE_DATA(tree)->count = 0; \
THROW_MESSAGE(DissectorError, \
@@ -292,8 +292,10 @@ static struct ws_memory_slab item_label_slab =
#define ITEM_LABEL_FREE(il) \
sl_free(&item_label_slab, il);
-#define PROTO_REGISTRAR_GET_NTH(hfindex, hfinfo) \
- DISSECTOR_ASSERT((guint)hfindex < gpa_hfinfo.len); \
+#define PROTO_REGISTRAR_GET_NTH(hfindex, hfinfo) \
+ if((guint)hfindex >= gpa_hfinfo.len && getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG")) \
+ g_error("Unregistered hf! index=%d", hfindex); \
+ DISSECTOR_ASSERT((guint)hfindex < gpa_hfinfo.len); \
hfinfo = gpa_hfinfo.hfi[hfindex];
/* List which stores protocols and fields that have been registered */