Wireshark-dev: [Wireshark-dev] range_string checking

From: Martin Mathieson <martin.r.mathieson@xxxxxxxxxxxxxx>
Date: Thu, 2 Apr 2020 21:08:09 +0000
Hi,

I have been adding checking to proto.c (that will be protected by #ifdef ENABLE_CHECK_FILTER) to see if range_string arrays passed into tmp_fld_check_assert() look sensible.

The checks I'm doing are:
(1) it is a problem if the max is < min for any range_string
(2) if an entry within an array is *completely* hidden by an earlier one, that is a problem (they are checked in the order they are given in try_rval_to_str_idx()

It is common to have a 'catch-all' case for parts or all of the range, which is Ok if it comes after more specific entries.  I'm wondering if its worth complaining if *part* of an entry is hidden by an earlier one?  Current output from master is as below.  I will try to fix them up where I can access the relevant specs, but wanted to check my understanding of how they work and how fussy we should be?  I will most likely update README.dissector to make sure it is clear how it is evaluated in order.

Best regards,
Martin

value_range_string error:  AVBTP Subtype (ieee1722.subtype) hidden by earlier entry (prev="Reserved for future protocols":  131 -> 237)  (this="ECC Signed Control Format":  236 -> 236)
value_range_string error:  AVBTP Subtype (ieee1722.subtype) hidden by earlier entry (prev="Reserved for future protocols":  131 -> 237)  (this="ECC Encrypted Control Format":  237 -> 237)
value_range_string error:  Quality of Service Delay class (diameter.3gpp.qos.delay_cls) entry for "Reserved" - max(0) is less than min(7)
value_range_string error:  Application Id (eiss.app_id) entry for "Signed Application" - max(16383) is less than min(16384)
value_range_string error:  Nature of address indicator (gsm_map.locationnumber.nai) hidden by earlier entry (prev="spare":  112 -> 126)  (this="reserved for national use":  112 -> 126)
value_range_string error:  TP-Failure-Cause (TP-FCS) (gsm_sms.tp-fcs) hidden by earlier entry (prev="TP-PID errors":  128 -> 143)  (this="Telematic interworking not supported":  128 -> 128)
value_range_string error:  TP-Failure-Cause (TP-FCS) (gsm_sms.tp-fcs) hidden by earlier entry (prev="TP-PID errors":  128 -> 143)  (this="Short message Type 0 not supported":  129 -> 129)
value_range_string error:  TP-Failure-Cause (TP-FCS) (gsm_sms.tp-fcs) hidden by earlier entry (prev="TP-PID errors":  128 -> 143)  (this="Cannot replace short message":  130 -> 130)
value_range_string error:  TP-Failure-Cause (TP-FCS) (gsm_sms.tp-fcs) hidden by earlier entry (prev="TP-PID errors":  128 -> 143)  (this="Reserved":  131 -> 142)
value_range_string error:  TP-Failure-Cause (TP-FCS) (gsm_sms.tp-fcs) hidden by earlier entry (prev="TP-PID errors":  128 -> 143)  (this="Unspecified TP-PID error":  143 -> 143)
value_range_string error:  TP-Failure-Cause (TP-FCS) (gsm_sms.tp-fcs) hidden by earlier entry (prev="TP-PID errors":  128 -> 143)  (this="Reserved":  131 -> 142)
value_range_string error:  TP-Failure-Cause (TP-FCS) (gsm_sms.tp-fcs) hidden by earlier entry (prev="Reserved":  131 -> 142)  (this="Reserved":  131 -> 142)
value_range_string error:  Message Type (hislip.messagetype) hidden by earlier entry (prev="FatalError":  2 -> 3)  (this="Error":  3 -> 3)
value_range_string error:  Notify Message Type (isakmp.notify.msgtype) hidden by earlier entry (prev="RESERVED":  15 -> 16)  (this="RESERVED":  15 -> 16)
value_range_string error:  Type of delayed charging information (isup.japan.charge_delay_type) hidden by earlier entry (prev="Reserved for network specific use":  1 -> 252)  (this="Spare":  129 -> 250)
value_range_string error:  Type (nan.ranging_setup.type) entry for "Response" - max(0) is less than min(1)
value_range_string error:  Type (nan.ranging_setup.type) entry for "Termination" - max(0) is less than min(2)
value_range_string error:  destination_offset (optommp.destination_offset) hidden by earlier entry (prev="Wiegand Serial Event Configuration - Read/Write":  4048945152 -> 4059434879)  (this="SNAP High-Density Digital - Read Only":  4051730432 -> 4051738622)
value_range_string error:  destination_offset (optommp.destination_offset) hidden by earlier entry (prev="Wiegand Serial Event Configuration - Read/Write":  4048945152 -> 4059434879)  (this="SNAP High-Density Digital Read and Clear - Read/Write":  4051738624 -> 4051746814)
value_range_string error:  destination_offset (optommp.destination_offset) hidden by earlier entry (prev="Wiegand Serial Event Configuration - Read/Write":  4048945152 -> 4059434879)  (this="SNAP High-Density Digital Write - Read/Write":  4051746816 -> 4051747838)
value_range_string error:  Video/Audio Control Data (tn5250.vac_data) hidden by earlier entry (prev="Set PIP Location and Size":  0 -> 4294967295)  (this="Set PIP See Through On":  520093697 -> 520093697)
value_range_string error:  Video/Audio Control Data (tn5250.vac_data) hidden by earlier entry (prev="Set PIP Location and Size":  0 -> 4294967295)  (this="Set PIP SeeThrough Off":  520093696 -> 520093696)
value_range_string error:  Video/Audio Control Data (tn5250.vac_data) hidden by earlier entry (prev="Set PIP Location and Size":  0 -> 4294967295)  (this="Freeze PIP":  536870913 -> 536870913)
value_range_string error:  Video/Audio Control Data (tn5250.vac_data) hidden by earlier entry (prev="Set PIP Location and Size":  0 -> 4294967295)  (this="Resume After Freeze":  536870912 -> 536870912)
value_range_string error:  Video/Audio Control Data (tn5250.vac_data) hidden by earlier entry (prev="Set PIP Location and Size":  0 -> 4294967295)  (this="Set PC/TV Channel":  301989888 -> 301989988)
value_range_string error:  Video/Audio Control Data (tn5250.vac_data) hidden by earlier entry (prev="Set PIP Location and Size":  0 -> 4294967295)  (this="Set Antenna Tuner Source":  285212672 -> 285212672)
value_range_string error:  Video/Audio Control Data (tn5250.vac_data) hidden by earlier entry (prev="Set PIP Location and Size":  0 -> 4294967295)  (this="Set Cable Tuner Source":  285212673 -> 285212673)
value_range_string error:  Video/Audio Control Data (tn5250.vac_data) hidden by earlier entry (prev="Set PIP Location and Size":  0 -> 4294967295)  (this="Disable Internal Speaker":  553648129 -> 553648129)
value_range_string error:  Video/Audio Control Data (tn5250.vac_data) hidden by earlier entry (prev="Set PIP Location and Size":  0 -> 4294967295)  (this="Enable Internal  Speaker":  553648128 -> 553648128)
value_range_string error:  Video/Audio Control Data (tn5250.vac_data) hidden by earlier entry (prev="Set PIP Location and Size":  0 -> 4294967295)  (this="Keyboard Disable":  385875969 -> 385875969)
value_range_string error:  Video/Audio Control Data (tn5250.vac_data) hidden by earlier entry (prev="Set PIP Location and Size":  0 -> 4294967295)  (this="Keyboard Enable":  385875968 -> 385875968)
value_range_string error:  Video/Audio Control Data (tn5250.vac_data) hidden by earlier entry (prev="Set PIP Location and Size":  0 -> 4294967295)  (this="Set PC/TV Brightness":  218103808 -> 218103908)
value_range_string error:  Video/Audio Control Data (tn5250.vac_data) hidden by earlier entry (prev="Set PIP Location and Size":  0 -> 4294967295)  (this="Set PC/TV Color":  251658240 -> 251658340)
value_range_string error:  Video/Audio Control Data (tn5250.vac_data) hidden by earlier entry (prev="Set PIP Location and Size":  0 -> 4294967295)  (this="Set PC/TV Contrast":  234881024 -> 234881124)
value_range_string error:  Video/Audio Control Data (tn5250.vac_data) hidden by earlier entry (prev="Set PIP Location and Size":  0 -> 4294967295)  (this="Set PC/TV Tint":  268435456 -> 268461156)
value_range_string error:  Data Field (tn5250.dfdpck_data_field) hidden by earlier entry (prev="Invalid Data Field Type":  0 -> 64)  (this="Top Row Command Key Functions":  64 -> 64)
value_range_string error:  Profile (zbee_aps.profile) hidden by earlier entry (prev="IEEE_1451_5":  48896 -> 48896)  (this="IEEE_1451_5":  48896 -> 48896)
value_range_string error:  Profile (zbee_aps.profile) hidden by earlier entry (prev="Unallocated Manufacturer-Specific":  48896 -> 49151)  (this="IEEE_1451_5":  48896 -> 48896)
value_range_string error:  Notification Scheme (zbee_zcl_se.met.mirror_report_attribute_response.notification_scheme) hidden by earlier entry (prev="For MSP Requirements":  129 -> 255)  (this="Reserved":  255 -> 255)
value_range_string error:  Notification Scheme (zbee_zcl_se.met.configure_mirror.notification_scheme) hidden by earlier entry (prev="For MSP Requirements":  129 -> 255)  (this="Reserved":  255 -> 255)
value_range_string error:  Notification Scheme (zbee_zcl_se.met.configure_notification_scheme.notification_scheme) hidden by earlier entry (prev="For MSP Requirements":  129 -> 255)  (this="Reserved":  255 -> 255)
value_range_string error:  Notification Scheme (zbee_zcl_se.met.configure_notification_flags.notification_scheme) hidden by earlier entry (prev="For MSP Requirements":  129 -> 255)  (this="Reserved":  255 -> 255)
value_range_string error:  Notification Scheme (zbee_zcl_se.met.get_notified_msg.notification_scheme) hidden by earlier entry (prev="For MSP Requirements":  129 -> 255)  (this="Reserved":  255 -> 255)
value_range_string error:  Profile ID (zbee_zcl_general.touchlink.profile_id) hidden by earlier entry (prev="IEEE_1451_5":  48896 -> 48896)  (this="IEEE_1451_5":  48896 -> 48896)
value_range_string error:  Profile ID (zbee_zcl_general.touchlink.profile_id) hidden by earlier entry (prev="Unallocated Manufacturer-Specific":  48896 -> 49151)  (this="IEEE_1451_5":  48896 -> 48896)
value_range_string error:  Profile (zbee_zdp.profile) hidden by earlier entry (prev="IEEE_1451_5":  48896 -> 48896)  (this="IEEE_1451_5":  48896 -> 48896)
value_range_string error:  Profile (zbee_zdp.profile) hidden by earlier entry (prev="Unallocated Manufacturer-Specific":  48896 -> 49151)  (this="IEEE_1451_5":  48896 -> 48896)