Wireshark-dev: Re: [Wireshark-dev] Custom dissector causing wireshark to crash

From: "Maynard, Chris" <Christopher.Maynard@xxxxxxxxx>
Date: Tue, 25 Aug 2009 21:41:18 -0400
You are using BASE_NONE for integers.  This isn't allowed.  Ref: doc/README.developer.
 
BTW, any reason why one of your display filters is called "mac.priority" and not "abc.priority"?
 
- Chris

________________________________

From: wireshark-dev-bounces@xxxxxxxxxxxxx on behalf of Patrick Lannigan
Sent: Tue 8/25/2009 6:09 PM
To: Developer support list for Wireshark
Subject: Re: [Wireshark-dev] Custom dissector causing wireshark to crash


I fixed the change you mentioned and am still failing at the same proto_register_field_array call.


        static hf_register_info hf[] = {
        { &hf_abc_flags, 
            { "Flags", "abc.flags",
            FT_UINT8, BASE_NONE,
            NULL, 0x0, NULL, HFILL }
        },
        { &hf_abc_crc,
            { "CRC", "abc.crc",
            FT_UINT16, BASE_HEX,
            NULL, 0x0, NULL, HFILL }
        },
        { &hf_abc_txPower, 
            { "txPower", "abc.txPower",
            FT_UINT8, BASE_DEC,
            NULL, 0x0,
            "Transmit power for message in dBm",
            HFILL }
        },
        { &hf_abc_frameType, 
            { "frameType", "abc.frameType",
            FT_UINT16, BASE_NONE,
            NULL, 0x0, NULL, HFILL }
        },
        { &hf_abc_prevHop, 
            { "prevHop", "abc.prevHop",
            FT_UINT32, BASE_HEX,
            NULL, 0x0,
            "Address of node that message was received from",
            HFILL }
        },
        { &hf_abc_nextHop, 
            { "nextHop", "abc.nextHop",
            FT_UINT32, BASE_HEX,
            NULL, 0x0,
            "Address of node that message is being sent to",
            HFILL }
        },
        { &hf_abc_seqNum, 
            { "seqNum", "abc.seqNum",
            FT_UINT8, BASE_DEC,
            NULL, 0x0, NULL, HFILL }
        },
        { &hf_abc_priority, 
            { "priority", "mac.priority",
            FT_UINT8, BASE_NONE,
            NULL, 0x0, NULL, HFILL }
        },
        { &hf_abc_frameContentLen, 
            { "frameContentLen", "abc.frameContentLen",
            FT_UINT16, BASE_DEC,
            NULL, 0x0,
            "Length of buffer sent OTA including mac headers",
            HFILL }
        },
        { &hf_abc_duration, 
            { "duration", "abc.duration",
            FT_UINT16, BASE_DEC,
            NULL, 0x0,
            "Duration in microsec used for CSMA NAV calculation",
            HFILL }
        },
        { &hf_abc_token, 
            { "token", "abc.token",
            FT_UINT32, BASE_NONE,
            NULL, 0x0, NULL, HFILL }
        },
        { &hf_abc_linkProfile, 
            { "linkProfile", "abc.linkProfile",
            FT_UINT32, BASE_NONE,
            NULL, 0x0,
            "Linkprofile used to xmit this packet, tmp until we know how the PHY is going to provide this info",
            HFILL }
        },
        { &hf_abc_expirationTime,
            {"expirationTime", "abc.expirationTime",
            FT_UINT16, BASE_DEC,
            NULL, 0x0,
            "Time in ms this frame may take to be delivered to its next hop",
            HFILL }
        },
        { &hf_abc_padding,
            {"padding", "abc.padding",
            FT_UINT16, BASE_NONE,
            NULL, 0x0, NULL, HFILL }
        }
    };

Patrick


On Tue, Aug 25, 2009 at 5:28 PM, Bill Meier <wmeier@xxxxxxxxxxx> wrote:


	> It then fails on:
	>
	> proto_register_field_array (proto_abc, hf, array_length (hf));
	>
	> Here is the hf array construction, can anyone see what the error is?
	>
	>     static hf_register_info hf[] = {
	 >
	
	
	>         { &hf_abc_txPower,
	>             { "txPower", "abc.txPower",
	>             FT_UINT8, BASE_DEC,
	>             "Transmit power for message in dBm",
	>             0x0, NULL, HFILL }
	>         },
	
	
	should be
	

	         { &hf_abc_txPower,
	             { "txPower", "abc.txPower",
	
	             FT_UINT8, BASE_DEC, NULL, 0x0,
	             "Transmit power for message in dBm", HFILL }
	         },
	
	Stepping through the code (eg: proto_register-field_array) is the way to
	find bugs like this.
	


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


CONFIDENTIALITY NOTICE: The contents of this email are confidential
and for the exclusive use of the intended recipient. If you receive this
email in error, please delete it from your system immediately and 
notify us either by email, telephone or fax. You should not copy,
forward, or otherwise disclose the content of the email.

<<winmail.dat>>