The TRY_TO_FAKE_THIS_ITEM() speed optimization has a side effect in that it

will only process FT_PROTOCOL fields. As a result, proto_item_append_string()
calls may throw a dissector exception, as only a FT_STRING or FT_STRINGZ can be
appended to with this call.

In order to prevent these dissector assertions, silently return from the append
call if the field is a FT_PROTOCOL.

Note that when the tree is visible, the updates of the fields occur normally,
as expected.

svn path=/trunk/; revision=16035
This commit is contained in:
Olivier Biot 2005-09-28 07:08:57 +00:00
parent 58534475ef
commit 3452023b80
1 changed files with 4 additions and 0 deletions

View File

@ -1572,6 +1572,10 @@ proto_item_append_string(proto_item *pi, const char *str)
fi = PITEM_FINFO(pi);
hfinfo = fi->hfinfo;
if (hfinfo->type == FT_PROTOCOL) {
/* TRY_TO_FAKE_THIS_ITEM() speed optimization: silently skip */
return;
}
DISSECTOR_ASSERT(hfinfo->type == FT_STRING || hfinfo->type == FT_STRINGZ);
old_str = fvalue_get(&fi->value);
new_str = g_strdup_printf("%s%s", old_str, str);