summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2017-05-28 11:26:05 +0300
committerMichael Mann <mmann78@netscape.net>2017-05-29 23:58:02 +0000
commitc299afe0e3671ddbfba984ba67e44baeb368714e (patch)
tree5ca342adbf27a17e4ad771c0f04e91b37828e258
parent346d16d0fdd97e9fd282ac7d0da156cc5590c857 (diff)
downloadwireshark-c299afe0e3671ddbfba984ba67e44baeb368714e.tar.gz
gif: expert info for unknown data block type
Before this patch, the dissector would assume that any data block type that is unknown must be the trailer byte. Check explicitly if we have a trailer byte and bring up an expert info for unknown data block types. Change-Id: I4c3087eb403e2e668a22628062edd0240309a2bc Reviewed-on: https://code.wireshark.org/review/21790 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--epan/dissectors/file-gif.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/epan/dissectors/file-gif.c b/epan/dissectors/file-gif.c
index be649bda5f..9dae667ac7 100644
--- a/epan/dissectors/file-gif.c
+++ b/epan/dissectors/file-gif.c
@@ -36,6 +36,7 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/expert.h>
#include <wsutil/str_util.h>
@@ -288,6 +289,7 @@ static gint ett_local_flags = -1;
static gint ett_extension = -1;
static gint ett_image = -1;
+static expert_field ei_gif_unknown_data_block_type = EI_INIT;
/****************** GIF protocol dissection functions ******************/
@@ -559,11 +561,17 @@ dissect_gif(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
if (ret <= 0)
break;
offset += ret;
- } else {
+ } else if (peek == 0x3B) { /* Trailer byte */
/* GIF processing stops at this very byte */
proto_tree_add_item(gif_tree, &hfi_trailer,
tvb, offset, 1, ENC_NA);
+ offset++;
break;
+ } else {
+ proto_tree_add_expert(gif_tree, pinfo,
+ &ei_gif_unknown_data_block_type,
+ tvb, offset, 1);
+ offset++;
}
proto_item_set_len(ti, offset-offset_start);
} /* while */
@@ -652,8 +660,17 @@ proto_register_gif(void)
&ett_image,
};
+ static ei_register_info ei[] = {
+ { &ei_gif_unknown_data_block_type,
+ { "gif.data_block_type.unknown", PI_PROTOCOL, PI_WARN,
+ "Unknown GIF data block type", EXPFILL }
+ }
+ };
+
int proto_gif;
+ expert_module_t* expert_gif;
+
/* Register the protocol name and description */
proto_gif = proto_register_protocol(
"Compuserve GIF",
@@ -667,6 +684,8 @@ proto_register_gif(void)
* and subtrees used */
proto_register_fields(proto_gif, hfi, array_length(hfi));
proto_register_subtree_array(ett, array_length(ett));
+ expert_gif = expert_register_protocol(proto_gif);
+ expert_register_field_array(expert_gif, ei, array_length(ei));
gif_handle = register_dissector(IMG_GIF, dissect_gif, proto_gif);
}