Wireshark-bugs: [Wireshark-bugs] [Bug 3884] Assertion caused by fuzz test file
Date: Sat, 11 Aug 2012 02:01:12 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3884

--- Comment #17 from Jakub Zawadzki <darkjames-ws@xxxxxxxxxxxx> 2012-08-11 02:01:03 PDT ---
(In reply to comment #15)
> (In reply to comment #14)
> > @@ -166,6 +166,10 @@ expert_set_info_vformat(packet_info *pinfo, proto_item
> > *pi,.
> > +       if (pinfo == NULL && pi->tree_data)
> > +               pinfo = PTREE_DATA(pi)->pinfo;
> > 
> > Gerald, does it work when dissecting without tree?
> > I'm afraid it will crash with NULL dereference (pi == NULL).
> 
> It worked in my tests here but it looks like it would be an easy
> condition to trigger. I added a check in r44437.

Well my idea was not to add NULL check, but revert part of it :P

#v+
if (entries > AFP_MAX_ACL_ENTRIES) {
-  expert_add_info_format(pinfo, item, PI_UNDECODED, PI_WARN, "Too ...);
+  expert_add_info_format(NULL, item, PI_UNDECODED, PI_WARN, "Too ...);
   THROW(ReportedBoundsError);
}
#v-

Now afp dissector won't add this expert info when item is NULL.

Generaly using PTREE_DATA(tree)->pinfo is only ok inside
report_type_length_mismatch(), and should be moved there, to not confuse user
that it's enough to pass tree (r44441).


If you dislike passing packet_info to lot of function, we might add new
function:
  packet_info *dissection_get_current_pinfo(void);

which should be easy to implement -- return some global variable, or variable
from TLS.

But IMHO each dissector should pass pinfo, or some variant of it for storing
state (instead of using global variables).

(I'd send this mail to wireshark-dev, but I don't have access to my mail
account, sorry).

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are watching all bug changes.