On Tue, Dec 30, 2003 at 11:21:43AM -0800, Jon Howell wrote:
> Unfortunately, on some packets, tethereal -T pdml falls over with:
>
> Unhandled exception ("XCEPT_GROUP_ETHEREAL", group=1, code=2)
> Aborted
I've checked in a fix, and have attached a patch for it.
Index: print.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/print.c,v
retrieving revision 1.67
diff -c -r1.67 print.c
*** print.c 10 Dec 2003 22:52:08 -0000 1.67
--- print.c 30 Dec 2003 23:12:10 -0000
***************
*** 131,136 ****
--- 131,137 ----
GSList *src_le;
data_source *src;
tvbuff_t *src_tvb;
+ gint length, tvbuff_length;
for (src_le = src_list; src_le != NULL; src_le = src_le->next) {
src = src_le->data;
***************
*** 138,145 ****
if (fi->ds_tvb == src_tvb) {
/*
* Found it.
*/
! return tvb_get_ptr(src_tvb, fi->start, fi->length);
}
}
g_assert_not_reached();
--- 139,158 ----
if (fi->ds_tvb == src_tvb) {
/*
* Found it.
+ *
+ * XXX - a field can have a length that runs past
+ * the end of the tvbuff. Ideally, that should
+ * be fixed when adding an item to the protocol
+ * tree, but checking the length when doing
+ * that could be expensive. Until we fix that,
+ * we'll do the check here.
*/
! length = fi->length;
! tvbuff_length = tvb_length_remaining(src_tvb,
! fi->start);
! if (length > tvbuff_length)
! length = tvbuff_length;
! return tvb_get_ptr(src_tvb, fi->start, length);
}
}
g_assert_not_reached();
***************
*** 184,190 ****
pd = get_field_data(pdata->src_list, fi);
print_hex_data_buffer(pdata->fh, pd, fi->length,
pdata->encoding, pdata->format);
! }
/* If we're printing all levels, or if this node is one with a
subtree and its subtree is expanded, recurse into the subtree,
--- 197,203 ----
pd = get_field_data(pdata->src_list, fi);
print_hex_data_buffer(pdata->fh, pd, fi->length,
pdata->encoding, pdata->format);
! }
/* If we're printing all levels, or if this node is one with a
subtree and its subtree is expanded, recurse into the subtree,