Wireshark-dev: Re: [Wireshark-dev] Debugging an assertion failure

From: Paul Offord <Paul.Offord@xxxxxxxxxxxx>
Date: Fri, 14 Apr 2017 20:27:16 +0000
Thanks to all for the suggestions.

The assertion fails because the module name being passed is (none) and obviously the parenthesis are a problem.  I think I know what's causing this and I'll investigate tomorrow.

I eventually settled on Graham's suggestion to catch it and changed the code to:

        for (p = name; (c = *p) != '\0'; p++)
        {
            if (g_ascii_islower(c) || g_ascii_isdigit(c) || c == '_' || c == '-' || c == '.') {
                int dummy = 0; // breakpoint here.
            }
            else
            {
                int dummy2 = 0;
            }

            g_assert(g_ascii_islower(c) || g_ascii_isdigit(c) || c == '_' ||
                c == '-' || c == '.');
        }

And then set a break point on the dummy2 line.

Best regards...Paul

-----Original Message-----
From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of Guy Harris
Sent: 14 April 2017 20:46
To: Developer support list for Wireshark <wireshark-dev@xxxxxxxxxxxxx>
Subject: Re: [Wireshark-dev] Debugging an assertion failure

On Apr 14, 2017, at 12:41 PM, Guy Harris <guy@xxxxxxxxxxxx> wrote:

> On Apr 14, 2017, at 3:41 AM, Paul Offord <Paul.Offord@xxxxxxxxxxxx> wrote:
> 
>> I need some advice.  I’m debugging a problem with a dissector I’ve written.  Tshark fails with:
>> … \epan\prefs.c:414:prefs_register_module_or_subtree: assertion failed: (g_ascii_islower(c) || g_ascii_isdigit(c) || c == '_' || c == '-' || c == '.')
> 
> Your dissector probably has, in its "filter name", a character that is not any of 'a'-'z', '_', '-', or '.'.

No, that's "your *protocol* probably has...", but the code to register a protocol should already be catching that and failing.

So perhaps you're directly calling prefs_register_module() and passing it a module name containing a character that's not one of those.  Don't do that in a dissector - call prefs_register_protocol(), which uses the protocol's filter name as the preferences module name.

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe

______________________________________________________________________

This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.

Any views or opinions expressed are solely those of the author and do not necessarily represent those of Advance Seven Ltd. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission.

Advance Seven Ltd. Registered in England & Wales numbered 2373877 at Endeavour House, Coopers End Lane, Stansted, Essex CM24 1SJ

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________