Ethereal-dev: Re: [Ethereal-dev] Re: About bug 188

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: didier <dgautheron@xxxxxxxx>
Date: Fri, 27 May 2005 19:31:04 +0000
ronnie sahlberg wrote:
I have checked in a fix. it should work now.
Thanks for the bugreport.

The problem is that proto_item_append_string() does not play well with
the TRY_TO_FAKE_THIS_ITEM() optimization.
Fortunately proto_item_append_string() is very rare,   essentially
only called from WSP.

I have added a comment to proto_item_append_string() and how it
interacts (or fails to interact) with TRY_TO_FAKE_THIS_ITEM() and what
one needs to do if one uses this function.

I have added a change to WSP so that it will unconditionally disable
the optimization for WSP and all subdissectors of WSP.

Hmm no comment :) Well yes, it won't work for my code, I'm creating the tree structure only once per run...

It won't solve the pb with xxx_set_len, xxx_get_len where ethereal could set/get the size of a wrong item,
From a quick browsing, It seems that :
packet-quake.c is broken, packet-m2tp.c is ok because it's an _add_text item.
I have no idea what ptvcursors (use by packet-ncp2222.inc)  do.

What about
1) A new parameter to proto_register_protocol
PROTO_NO_OPTIMIZE  /* default proto can  */

2) use a new flag in struct field_info.flags
FI_something set each time TRY_TO_FAKE_THIS_ITEM() return
If it's set in get_len then THROW an error, saying the dissector need PROTO_NO_OPTIMIZE if it"s set in set_len THROW the same error. Currently most (all?) set_len are on always allocated add_text item.
At least it won't fail silently.

Didier