Commit Graph

86196 Commits

Author SHA1 Message Date
João Valverde bc74d2e3e4 dftest: Fix command-line argument parsing
Expressions that start with hyphen clash with command-line options.
In that case we need to pass "--" to dftest to stop processing
options.

Fix the test suite to do this. Fixes failures with dftest and
expressions like:

    -2 == tcp.port

Replace the GLib option parser with getopt while at it. The GLib API
is nice but isn't a good fit for this utility and the code appears to
be inconsistent on whether "--" is left in the argv or not.
2022-12-30 18:27:30 +00:00
João Valverde d3d06c2552 dftest: Add debug command-line options 2022-12-30 13:42:26 +00:00
John Thacker 55ffdb08bb conversation: Remove conversation from the correct table
In conversation_set_addr2, if the existing conversation has
a port2, remove it from the _no_addr2 hashtable, not the _no_port2
hashtable.

Fix #18766
2022-12-30 13:16:56 +00:00
Martin Mathieson dfd3a4d61b check_tfs: find entries that define value_string identical to common tfs 2022-12-30 11:56:41 +00:00
Joakim Karlsson a661ebaae2 DECT-NWK: fix build issue [-Werror=maybe-uninitialized] 2022-12-30 11:17:06 +00:00
Joakim Karlsson 3c0cdc9e3d SNMP: generate ASN1 2022-12-30 10:34:21 +01:00
John Thacker 67db53abbf epan: Fixup get_ascii_string change
prev needs to be advanced to ptr on an invalid character even
if there aren't any bytes to copy (because we have two invalid
characters in a row.) Fixup ba7917309a

Fix #18769.
2022-12-29 22:44:37 -05:00
Joakim Karlsson 2ce57fcc19 pfcp: correction of IE 5GS User Plane Node
Fix #18760
2022-12-30 02:09:55 +00:00
Joakim Karlsson 5c151df3ad diameter: Update geographical_description 2022-12-30 02:04:42 +00:00
Joakim Karlsson 23427cc9ba LCS-AP: Update to 3GPP TS 29.171 V17.2.0 2022-12-30 02:03:33 +00:00
Joakim Karlsson 931824f4ff gsm_common: Update geographical_description 2022-12-30 02:02:42 +00:00
João Valverde 53153725bb dftest: Add a missing goto statement 2022-12-30 01:10:27 +00:00
João Valverde 1400d92724 dfilter: Add compilation warning for ambiguous syntax
$ dfilter 'frame contains fc'
    Filter: frame contains fc

    Warning: Interpreting "fc" as "Fibre Channel". Consider writing :fc or .fc.
    (...)
2022-12-29 23:48:56 +00:00
John Thacker ba7917309a charsets: Optimize ENC_ASCII by appending valid bytes at once
For ASCII encoding, most bytes are copied directly. Count consecutive
valid bytes in an accumulator and append them all at once when we
get an invalid character with the high bit set, or at the end.
This reduces the number of reallocations and allows larger, more
optimized memcpys.
2022-12-29 21:02:12 +00:00
Gerald Combs afe5ed0aa5 epan: Initialize variables in various dissectors
Fix the following valgrind warnings:

==15172== Conditional jump or move depends on uninitialised value(s)
==15172==    at 0x78B0849: unescape_and_tvbuffify_telnet_option (epan/dissectors/packet-telnet.c:1043)

==15172== Conditional jump or move depends on uninitialised value(s)
==15172==    at 0x76917C8: dissect_rohc_ir_rtp_profile_dynamic (epan/dissectors/packet-rohc.c:1667)

==15172== Conditional jump or move depends on uninitialised value(s)
==15172==    at 0x70DCBF1: dissect_gsm_rlcmac_downlink (epan/dissectors/packet-gsm_rlcmac.c:9770)

==15172== Conditional jump or move depends on uninitialised value(s)
==15172==    at 0x6C7958E: set_mime_hdr_flags (epan/dissectors/packet-beep.c:392)

Fixes #18742
2022-12-29 19:27:16 +00:00
João Valverde af22c743bd dfilter: Refactor error location for expressions
Underline the whole expression for errors, not just the token.
Implement it for all expressions.
2022-12-29 18:28:54 +00:00
João Valverde 77ef21f86e dfilter: Replace unparsed lexical type and simplify grammar
Remove unparsed lexical type and replace it with identifier
and constant. This separation is still necessary to differentiate
names (fields and function) from literals that look like names
but it has some advantages to do it at the lexical level.

The main advantage is a much cleaner and simplified grammar,
because we only have a single token type for field names, without
any loss of generality (the same name is valid for fields and
function names for example).

The CONSTANT token type is necessary to be different from literal
to provide errors for function rules.
2022-12-29 18:28:54 +00:00
João Valverde bdd00edac8 dfilter: Rename grammar rules 2022-12-29 18:28:54 +00:00
João Valverde b577b8a37f Add WS_WARN_UNUSED function attribute 2022-12-29 18:28:54 +00:00
João Valverde 508a4011ac tests: Rename test group 2022-12-29 18:28:54 +00:00
João Valverde 0fbf65f48b dftest: Add elapsed time 2022-12-29 18:28:54 +00:00
Martin Mathieson 92a81b1361 Enable checks for proto_tree_add_bits APIs 2022-12-29 17:35:18 +00:00
Bernhard Dick fefc28a743 DECT-NWK: Fix BCD encoded non byte aligned strings
As proto_tree_add_bits_item does not support FT_STRING header fields
dissection of non byte aligned fields containing BCD values has been
rewritten using explicit reading of the BCD values and usage of
proto_tree_add_string
2022-12-29 09:05:29 +00:00
Bernhard Dick 4a0d7e9bbb DECT-NWK: Fix hf types for bitfields
Bitfields are neither allowed to be of type FT_NONE or FT_UINT_BYTES.
This commit fixes this for padding fields (being max 7 bits of zeroes,
thus FT_UINT8) and one field currently named as FT_UINT_BYTES that can
just be represented as FT_BYTES
2022-12-29 09:05:29 +00:00
Chuck Craft 1d6cf2f513 prefs: report load error in gui popup
ws_warning logs to console which most users will never see.
https://ask.wireshark.org/question/30035/new-computer-setup-custom-columns/
2022-12-29 04:02:15 +00:00
João Valverde 95f705dd8b dfilter: Improve error location for functions
Underline the whole expression if the error is for the function.

Before:

    Filter: frame.number == abs(1, 2)
    dftest: Function abs can only accept 1 arguments.
    	frame.number == abs(1, 2)
    	                ^~~
After:

    Filter: frame.number == abs(1, 2)
    dftest: Function abs can only accept 1 arguments.
    	frame.number == abs(1, 2)
    	                ^~~~~~~~~
2022-12-28 20:26:00 +00:00
Kevin Albertson bdb1616cf0 fix size_t cast warnings on Windows 2022-12-28 05:00:45 +00:00
Kevin Albertson 611eae17c8 add mongo zstd test to suite_dissection.py 2022-12-28 05:00:45 +00:00
Kevin Albertson eca4655a48 use uncompress_zstd in Kafka 2022-12-28 05:00:45 +00:00
Kevin Albertson f5c400c6e7 mongo: support zstd
use tvb_child_uncompress_zstd from packet-mongo
2022-12-28 05:00:45 +00:00
Kevin Albertson 8dd82ff741 add zstd_tests 2022-12-28 05:00:45 +00:00
Kevin Albertson 0ea91fc6fa error on extra data 2022-12-28 05:00:45 +00:00
Kevin Albertson a9037f45c7 do not create composite buffer with empty data
This results in an exception on tvb_composite_finalize.
2022-12-28 05:00:45 +00:00
Kevin Albertson 2f9fd85ae9 add tvbuff_zstd.c 2022-12-28 05:00:45 +00:00
Gerald Combs e93989c56a Qt: Fix an IAX2 Analysis dialog memory leak.
Fix

*** CID 1517838:  Resource leaks  (RESOURCE_LEAK)
/builds/wireshark/wireshark/ui/qt/iax2_analysis_dialog.cpp: 311 in Iax2AnalysisDialog::Iax2AnalysisDialog(QWidget &, CaptureFile &)()
305         }
306
307         if (!cap_file_.capFile() || !cap_file_.capFile()->current_frame) {
308             err_str_ = tr("Please select an IAX2 packet.");
309             save_payload_error_ = TAP_IAX2_NO_PACKET_SELECTED;
310             updateWidgets();
>>>     CID 1517838:  Resource leaks  (RESOURCE_LEAK)
>>>     Variable "sfcode" going out of scope leaks the storage it points to.
311             return;
312         }
313
314         if (!cf_read_current_record(cap_file_.capFile())) close();
315
316         frame_data *fdata = cap_file_.capFile()->current_frame;
2022-12-27 22:58:05 +00:00
João Valverde 6c1ee11172 dfilter: Allow compatible types to be compared in min/max 2022-12-27 21:09:04 +00:00
João Valverde e85f8d4cf1 dfilter: Do not jump when generating function arguments
Instead of "jumping" with length zero to the next sequential
instruction skip generating the no-op jump instruction entirely.
2022-12-27 21:09:04 +00:00
João Valverde f6a02a1e4a dfilter: Preserve function argument order when printing
Instead of printing back to front (from the top of the stack
print them front to back as a user would type them.
2022-12-27 21:09:04 +00:00
Guy Harris 0df8a7a872 SRT: expand comments to give more detail on the string encoding. 2022-12-27 10:38:44 -08:00
João Valverde 3c411657d5 SRT: Validate UTF-8 encoding
Fixes #18754.
2022-12-27 14:34:12 +00:00
Joakim Karlsson 939677f16e pfcp: Update to 3GPP TS 29.244 V18.0.0 2022-12-27 13:20:48 +00:00
Martin Mathieson 5bbe533244 WIP: Check types for _add_bits_ functions, and ensure no mask 2022-12-27 12:10:03 +00:00
João Valverde b19bed43d1 dfilter: Allow constants as the first or only argument to min/max
The strategy here is to delay resolving literals to values until
we have looked at the entire argument list.

Also we will try to commute the relation in a comparison if
we do not have a type for the return value of the function,
like any other constant.

Before:

    Filter: max(1,_ws.ftypes.int8) == 1
    dftest: Argument '1' is not valid for max()
    	max(1,_ws.ftypes.int8) == 1
    	    ^

After:

    Filter: max(1,_ws.ftypes.int8) == 1

    Syntax tree:
     0 TEST_ANY_EQ:
       1 FUNCTION(max#2):
         2 FVALUE(1 <FT_INT8>)
         2 FIELD(_ws.ftypes.int8 <FT_INT8>)
       1 FVALUE(1 <FT_INT8>)

    Instructions:
    00000 STACK_PUSH	1 <FT_INT8>
    00001 READ_TREE		_ws.ftypes.int8 <FT_INT8> -> reg#1
    00002 IF_FALSE_GOTO	3
    00003 STACK_PUSH	reg#1
    00004 CALL_FUNCTION	max(reg#1, 1 <FT_INT8>) -> reg#0
    00005 STACK_POP	2
    00006 IF_FALSE_GOTO	8
    00007 ANY_EQ		reg#0 == 1 <FT_INT8>
    00008 RETURN
2022-12-27 02:21:06 +00:00
João Valverde 6399f724d9 dfilter: Fix crash with min/max literal argument
Filter: max(1,_ws.ftypes.int8) == 1
     ** (dftest:64938) 01:43:25.950180 [DFilter ERROR] epan/dfilter/sttype-field.c:117 -- sttype_field_ftenum(): Magic num is 0x5cf30031, but should be 0xfc2002cf
2022-12-27 01:54:57 +00:00
Gerald Combs 6c8cdebe87 epan: Add a bounds check to get_utf_8_string
Check our current buffer position as well as our length.
Fixes #18758.
2022-12-27 01:54:23 +00:00
João Valverde 540b71d738 dfilter: Fix crash with a constant arithmetic expression 2022-12-26 23:55:27 +00:00
João Valverde 3ddb017a88 dfilter: Allow arithmetic expression to commute
Allow an arithmetic expression like 1 + some.field. If we
cannot assign a type to the LHS commute the terms and
try again.

Before:

    Filter: _ws.ftypes.int32 + 1 == 10

    Syntax tree:
     0 TEST_ANY_EQ:
       1 OP_ADD:
         2 FIELD(_ws.ftypes.int32 <FT_INT32>)
         2 FVALUE(1 <FT_INT32>)
       1 FVALUE(10 <FT_INT32>)

    Instructions:
    00000 READ_TREE		_ws.ftypes.int32 <FT_INT32> -> reg#0
    00001 IF_FALSE_GOTO	4
    00002 ADD		reg#0 + 1 <FT_INT32> -> reg#1
    00003 ANY_EQ		reg#1 == 10 <FT_INT32>
    00004 RETURN

    Filter: 1 + _ws.ftypes.int32 == 10
    dftest: Constant arithmetic expression on the LHS is invalid.
    	1 + _ws.ftypes.int32 == 10
    	^

After:

    Filter: _ws.ftypes.int32 + 1 == 10

    Syntax tree:
     0 TEST_ANY_EQ:
       1 OP_ADD:
         2 FIELD(_ws.ftypes.int32 <FT_INT32>)
         2 FVALUE(1 <FT_INT32>)
       1 FVALUE(10 <FT_INT32>)

    Instructions:
    00000 READ_TREE		_ws.ftypes.int32 <FT_INT32> -> reg#0
    00001 IF_FALSE_GOTO	4
    00002 ADD		reg#0 + 1 <FT_INT32> -> reg#1
    00003 ANY_EQ		reg#1 == 10 <FT_INT32>
    00004 RETURN

    Filter: 1 + _ws.ftypes.int32 == 10

    Syntax tree:
     0 TEST_ANY_EQ:
       1 OP_ADD:
         2 FVALUE(1 <FT_INT32>)
         2 FIELD(_ws.ftypes.int32 <FT_INT32>)
       1 FVALUE(10 <FT_INT32>)

    Instructions:
    00000 READ_TREE		_ws.ftypes.int32 <FT_INT32> -> reg#0
    00001 IF_FALSE_GOTO	4
    00002 ADD		1 <FT_INT32> + reg#0 -> reg#1
    00003 ANY_EQ		reg#1 == 10 <FT_INT32>
    00004 RETURN
2022-12-26 20:50:44 +00:00
João Valverde c37552c43c dfilter: Fix an assertion macro 2022-12-26 20:22:21 +00:00
João Valverde 1d544c2077 dfilter: Fix grammar memory leak 2022-12-26 18:48:54 +00:00
John Thacker f0f72927b4 epan: Allow FT_IPv4, FT_IPv6 custom columns to be resolved or not.
Similar to commit dbb9fe2a37, proto_item_fill_display_label
now uses address_to_display for FT_IPv4, FT_IPv6, and FT_FCWWN,
the other three address types that double as field types and which
have optional name resolution.

Add these to the list of types that, if present in a custom column,
has the GUI enable the checkbox to switch between "resolved" (names)
and not (values).

This allows adding custom columns with these field types with both
resolved and non resolved text. Note that the appropriate Name
Resolution preference settings must be enabled for the type as well.
2022-12-26 16:12:19 +00:00