wireshark/test/suite_dfilter
John Thacker e972a755d2 dfilter: Handle null arguments to min, max
min and max need to handle null arguments where the GPtrArray
is null, generated when there have been other opcodes between
the field loading and the function. (They are ignored, not
treated as zero, so they don't change the minimum.)

Prevents crashes with filters where a field does not exist in the tree:

min(tcp.srcport * 10, tcp.dstport * 10) == 800
min(len(tcp.payload), len(udp.payload)) == 153
min(len(tcp.payload[2:]) + 2, len(udp.payload[2:]) + 2) == 153

where a register is loaded where it has not had its GPtrArray created:

./run/dftest 'min(len(tcp.payload), len(udp.payload))'
Filter:
 min(len(tcp.payload), len(udp.payload))

Instructions:
 0000 READ_TREE        tcp.payload      -> R1
 0001 IF_FALSE_GOTO    3
 0002 LENGTH           R1               -> R2
 0003 STACK_PUSH       R2
 0004 READ_TREE        udp.payload      -> R3
 0005 IF_FALSE_GOTO    7
 0006 LENGTH           R3               -> R4
 0007 STACK_PUSH       R4
 0008 CALL_FUNCTION    min(R2, R4)      -> R0
 0009 STACK_POP        [2]
 0010 IF_FALSE_GOTO    12
 0011 NOT_ALL_ZERO     R0
 0012 RETURN

Related to fcb6bb5763
(Prior to that commit, this worked because a NULL pointer is a
valid, empty GSList.)
2024-02-06 15:32:57 +00:00
..
__init__.py Tests: Modernize dfilter assertions 2023-09-02 19:57:05 +01:00
dfiltertest.py dfilter: Add a function-like macro syntax 2023-11-08 15:48:00 +00:00
group_bytes.py Tests: Remove remaining legacy unittest code 2023-06-05 20:56:20 +00:00
group_columns.py epan: Register dynamic column fields and make them filterable 2023-07-25 00:49:52 +00:00
group_double.py Tests: Remove remaining legacy unittest code 2023-06-05 20:56:20 +00:00
group_ether.py Tests: Remove remaining legacy unittest code 2023-06-05 20:56:20 +00:00
group_function.py dfilter: Handle null arguments to min, max 2024-02-06 15:32:57 +00:00
group_integer.py Tests: Remove remaining legacy unittest code 2023-06-05 20:56:20 +00:00
group_ipv4.py Tests: Remove remaining legacy unittest code 2023-06-05 20:56:20 +00:00
group_ipv6.py dfilter: Add number lexical type 2023-10-22 11:08:37 +01:00
group_macro.py dfilter: Handle null arguments in macros better 2024-01-24 08:11:00 +00:00
group_membership.py dfilter: Be ready for unparsed syntax type in semantics check 2024-01-10 09:46:48 +00:00
group_scanner.py Tests: Remove remaining legacy unittest code 2023-06-05 20:56:20 +00:00
group_slice.py dfilter: Add back unparsed syntax type 2023-11-09 22:19:03 +00:00
group_string.py dfilter: Fix use-after-free 2023-09-28 16:14:15 +00:00
group_syntax.py dfilter: Fix diameter.3GPP-* filters 2023-11-23 12:31:38 +00:00
group_time.py dfilter: Add time multiplication by scalar floats 2023-10-22 11:08:37 +01:00
group_tvb.py dfilter: Add back unparsed syntax type 2023-11-09 22:19:03 +00:00
test_dmacros dfilter: Handle null arguments in macros better 2024-01-24 08:11:00 +00:00