Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] Some apparent type bugs

From: Martin Mathieson <martin.r.mathieson@xxxxxxxxxxxxxx>
Date: Fri, 31 Jul 2020 10:28:18 +0100
Hi,

I wrote a script to try to check the types of hf items passed to proto.h APIs where there is a subset of types that are allowed.  i.e. Trying to stop errors such as:

** (process:8243): WARNING **: Dissector bug, protocol IDN, in packet 126: epan/proto.c:11693: field idn.gts_wavelength_prefix is not of type FT_CHAR or an FT_{U}INTn type

** (process:8243): WARNING **: Dissector bug, protocol IDN, in packet 351: epan/proto.c:11693: field idn.gts_beam_brush is not of type FT_CHAR or an FT_{U}INTn type


without needing to encounter that call while dissecting a capture.




I won't have time to look into these properly for a few days - if anyone else does please feel free to check/fix them.

Error: proto_tree_add_item_ret_uint (.., hf_ecpri_address , ...) called at ./tools/../epan/dissectors/packet-ecpri.c 304 with type FT_UINT48
    (allowed types are {'FT_CHAR', 'FT_UINT32', 'FT_UINT24', 'FT_UINT16', 'FT_UINT8'} )

Error: proto_tree_add_item_ret_uint64 (.., hf_epl_od_uint , ...) called at ./tools/../epan/dissectors/packet-epl.c 2744 with type
    (allowed types are {'FT_UINT48', 'FT_UINT56', 'FT_UINT64', 'FT_UINT40'} )

Error: proto_tree_add_item_ret_uint (.., hf_ctlv_cmd_qual_send_short_msg , ...) called at ./tools/../epan/dissectors/packet-etsi_card_app_toolkit.c 1172 with type FT_BOOLEAN
    (allowed types are {'FT_CHAR', 'FT_UINT32', 'FT_UINT24', 'FT_UINT16', 'FT_UINT8'} )

Error: proto_tree_add_item_ret_uint (.., hf_ctlv_cmd_qual_send_data , ...) called at ./tools/../epan/dissectors/packet-etsi_card_app_toolkit.c 1182 with type FT_BOOLEAN
    (allowed types are {'FT_CHAR', 'FT_UINT32', 'FT_UINT24', 'FT_UINT16', 'FT_UINT8'} )

Error: proto_tree_add_item_ret_uint (.., hf_ndps_language_flag , ...) called at ./tools/../epan/dissectors/packet-ndps.c 5303 with type FT_BOOLEAN
    (allowed types are {'FT_CHAR', 'FT_UINT32', 'FT_UINT24', 'FT_UINT16', 'FT_UINT8'} )

Error: proto_tree_add_item_ret_uint (.., hf_ndps_method_flag , ...) called at ./tools/../epan/dissectors/packet-ndps.c 5310 with type FT_BOOLEAN
    (allowed types are {'FT_CHAR', 'FT_UINT32', 'FT_UINT24', 'FT_UINT16', 'FT_UINT8'} )

Error: proto_tree_add_item_ret_uint (.., hf_ndps_delivery_address_flag , ...) called at ./tools/../epan/dissectors/packet-ndps.c 5320 with type FT_BOOLEAN
    (allowed types are {'FT_CHAR', 'FT_UINT32', 'FT_UINT24', 'FT_UINT16', 'FT_UINT8'} )

Error: proto_tree_add_item_ret_uint (.., hf_ndps_language_flag , ...) called at ./tools/../epan/dissectors/packet-ndps.c 5857 with type FT_BOOLEAN
    (allowed types are {'FT_CHAR', 'FT_UINT32', 'FT_UINT24', 'FT_UINT16', 'FT_UINT8'} )

Error: proto_tree_add_item_ret_uint (.., hf_ndps_method_flag , ...) called at ./tools/../epan/dissectors/packet-ndps.c 5864 with type FT_BOOLEAN
    (allowed types are {'FT_CHAR', 'FT_UINT32', 'FT_UINT24', 'FT_UINT16', 'FT_UINT8'} )

Error: proto_tree_add_item_ret_uint (.., hf_ndps_delivery_address_flag , ...) called at ./tools/../epan/dissectors/packet-ndps.c 5874 with type FT_BOOLEAN
    (allowed types are {'FT_CHAR', 'FT_UINT32', 'FT_UINT24', 'FT_UINT16', 'FT_UINT8'} )

Error: proto_tree_add_item_ret_uint (.., hf_pfcp_nf_instance_id , ...) called at ./tools/../epan/dissectors/packet-pfcp.c 7482 with type FT_GUID
    (allowed types are {'FT_CHAR', 'FT_UINT32', 'FT_UINT24', 'FT_UINT16', 'FT_UINT8'} )

Error: proto_tree_add_item_ret_uint (.., hf_lcp_opt_id , ...) called at ./tools/../epan/dissectors/packet-ppp.c 2377 with type FT_UINT_BYTES
    (allowed types are {'FT_CHAR', 'FT_UINT32', 'FT_UINT24', 'FT_UINT16', 'FT_UINT8'} )

Error: proto_tree_add_item_ret_uint (.., hf_slsk_directory_name , ...) called at ./tools/../epan/dissectors/packet-slsk.c 1051 with type FT_UINT_STRING
    (allowed types are {'FT_CHAR', 'FT_UINT32', 'FT_UINT24', 'FT_UINT16', 'FT_UINT8'} )


I will clean up the script and see if it should be added to wireshark/tools in a few days.

Best regards,
Martin