Wireshark-dev: Re: [Wireshark-dev] Custom dissector causing wireshark to crash
From: Patrick Lannigan <p.lannigan@xxxxxxxxx>
Date: Tue, 25 Aug 2009 18:09:26 -0400
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