Commit graph

11634 commits

Author SHA1 Message Date
Jon Siwek
17e3392052 Avoid unary negation of INT64_MIN in modp_litoa10
Overlow can occur in that case, which is undefined behavior.
2020-09-18 11:32:05 -07:00
Jon Siwek
d25ead8f8e Avoid double-to-int conversion overflows in modp_dtoa functions
Those methods already had a fallback to use sprintf() for large values
except:

* The check-for-large-value was unnecessarily done after many
  operations that aren't relevant to the check and those operations can
  result in a conversion overflow (undefined behavior).

* The check-for-large-value was using the literal value for a
  32-bit INT_MAX instead of just using INT_MAX.  For a platform where
  `int` is less than 32-bits, the same conversion overflow from the
  previous point could still occur (undefined behavior).

* The check-for-large-value was not inclusive of INT_MAX.
  In a case where the conversion of INT_MAX itself to a double
  can't be represented exactly, it's implementation-defined whether
  the closest higher or closest lower representable-value is selected.
  If the higher value is selected, then a `double` value comparing equal
  to INT_MAX-as-converted-to-double would cause an overflow of an `int`
  upon conversion (undefined behavior).
2020-09-18 11:32:05 -07:00
Jon Siwek
264e6858f2 Fix divide-by-zero in Entropy analyzer 2020-09-18 11:32:05 -07:00
Jon Siwek
091424b2ad Fix divide-by-zero in stats/profiling memory usage calculation 2020-09-18 11:32:05 -07:00
Jon Siwek
5d33775430 Fix uninitialized field in POP3 fuzzer 2020-09-18 11:32:05 -07:00
Jon Siwek
efcbf979f5 Add framework for running UndefinedBehaviorSanitizer in CI
Many checks are initially disabled because they do cause failures
when running the test suites.
2020-09-18 11:32:05 -07:00
zeek-bot
eca8540147 Update doc submodule [nomail] [skip ci] 2020-09-18 00:35:27 +00:00
Tim Wojtulewicz
6b93020c6f Merge remote-tracking branch 'origin/topic/jsiwek/gh-1164-fix-rst-conn-state'
* origin/topic/jsiwek/gh-1164-fix-rst-conn-state:
  GH-1164: Fix incorrect RSTOS0 conn_state determinations
2020-09-17 13:40:06 -07:00
Tim Wojtulewicz
3b641870dc Merge remote-tracking branch 'origin/topic/jsiwek/gh-1119-conn-removal-callbacks'
* origin/topic/jsiwek/gh-1119-conn-removal-callbacks:
  GH-1119: add base/protcols/conn/removal-hooks.zeek
  Avoid run-time cost of find-filtered-trace.zeek for live traffic
  Remove connection_successful and successful_connection_remove events
2020-09-17 13:16:19 -07:00
Tim Wojtulewicz
26808ea7d4 Merge remote-tracking branch 'origin/topic/jsiwek/gh-1155-recursive-table-index-type-check'
* origin/topic/jsiwek/gh-1155-recursive-table-index-type-check:
  GH-1155: Recursively check table index for unsupported types
2020-09-17 11:42:57 -07:00
Tim Wojtulewicz
c7445a7d43 Merge remote-tracking branch 'origin/topic/jsiwek/gh-1159-interval-vector-arithmetic'
* origin/topic/jsiwek/gh-1159-interval-vector-arithmetic:
  GH-1159: Fix vector-of-interval multiplication/division arithmetic
2020-09-17 11:35:02 -07:00
Tim Wojtulewicz
0cb39a5c31 Merge remote-tracking branch 'origin/topic/christian/1074-avoid-packed-member-warning'
* origin/topic/christian/1074-avoid-packed-member-warning:
  Avoid passing address of member in packed struct #1074
2020-09-17 11:25:15 -07:00
Jon Siwek
33ca675515 GH-927: Fix circumvention of evaluation order in 'when' conditions
Historically, a 'when' condition performed an AST-traversal to locate
any index-expressions like `x[9]` and evaluated them so that it could
register the associated value as something for which it needs to receive
"modification" notifications.

Evaluating arbitrary expressions during an AST-traversal like that ignores
the typical order-of-evaluation/short-circuiting you'd expect if the
condition was evaluated normally, from its root expression.

Now, a new subclass of IndexExpr is used to keep track of all IndexExpr
results in the context of evaluating a 'when' condition without having
to do a secondary AST-traversal-and-eval.  i.e. the first evaluation of
the full 'when' condition follows the typical expression-evaluation
semantics (as always), but additionally now captures all the values
a Trigger needs to monitor for modifications.
2020-09-15 17:03:44 -07:00
Jon Siwek
a96440ea79 GH-1155: Recursively check table index for unsupported types
Previously, container types used within a table/set index were not
deeply checked to ensure all constituents could be part of an index.
2020-09-14 19:06:11 -07:00
Jon Siwek
3b334bad56 GH-1159: Fix vector-of-interval multiplication/division arithmetic
Those operations done between a vector-of-interval and a
vector-of-arithmetic-type previously threw a runtime expression error
due to an incorrect coercion being used internally.
2020-09-14 16:12:20 -07:00
Jon Siwek
0771dbcec6 Update submodule(s) [nomail]
Closes https://github.com/zeek/zeek/issues/1102
2020-09-14 13:40:02 -07:00
Jon Siwek
1046e45dba Improve notice/suppression-cluster btest to avoid race potential 2020-09-14 12:28:25 -07:00
Jon Siwek
572f1116d0 Update submodule(s) [nomail] [skip ci] 2020-09-14 10:44:22 -07:00
Jon Siwek
a16bd47bf7 GH-1164: Fix incorrect RSTOS0 conn_state determinations
The RSTOS0 `conn_state` label is documented as "Originator sent a SYN
followed by a RST, never saw SYN-ACK from responder", but was previously
applied to cases where no originator SYN exists, like a single RST-only
packet.
2020-09-11 16:14:41 -07:00
Jon Siwek
05cf511f18 GH-1119: add base/protcols/conn/removal-hooks.zeek
This adds two new functions: `Conn::register_removal_hook()` and
`Conn::unregister_removal_hook()` for registering a hook function to be
called back during `connection_state_remove`.  The benefit of using hook
callback approach is better scalability: the overhead of unrelated
protocols having to dispatch no-op `connection_state_remove` handlers is
avoided.
2020-09-11 12:12:10 -07:00
Jon Siwek
49e2047da0 Avoid run-time cost of find-filtered-trace.zeek for live traffic 2020-09-10 12:53:47 -07:00
Jon Siwek
5f435c2644 Remove connection_successful and successful_connection_remove events
Related to https://github.com/zeek/zeek/issues/1119
2020-09-10 12:06:50 -07:00
Jon Siwek
5945aec7e8 Fix generate-docs Action to stage autogenerated script-reference files 2020-09-10 11:54:51 -07:00
zeek-bot
2738b157ea Update doc submodule [nomail] [skip ci] 2020-09-10 00:33:38 +00:00
Jon Siwek
b620ace06b Merge remote-tracking branch 'origin/topic/jsiwek/reporter-weird-sampling-api-tweaks'
* origin/topic/jsiwek/reporter-weird-sampling-api-tweaks:
  Improve Reporter weird-sampling-whitelist getters/setters
2020-09-09 10:47:16 -07:00
Jon Siwek
6102e09ada Fix memory leak caused by re-entering GTPv1 parsing
If the inner packet of a decapsulated GTPv1 frame maps to the same
Connection as the outer packet and also contains another GTPv1
encapsulation, the same GTPv1 analyzer attempts to parse the inner
packet.  In the process, the inner parsing method overwrites pointers to
memory resources the outer parsing method has not yet released and
results in a memory leak.
2020-09-09 10:44:33 -07:00
Jon Siwek
145b4f9dd0 Fix memory leak caused by re-entering AYIYA parsing
If the inner packet of a decapsulated AYIYA frame maps to the same
Connection as the outer packet and also contains another AYIYA
encapsulation, the same AYIYA analyzer attempts to parse the inner
packet.  In the process, the inner parsing method overwrites pointers to
memory resources the outer parsing method has not yet released and
results in a memory leak.

Credit to OSS-Fuzz for discovery
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25256
2020-09-09 10:43:47 -07:00
Jon Siwek
e37baf09c0 Improve Reporter weird-sampling-whitelist getters/setters
- getter methods return const-ref
- setter methods pass by value and std::move()
- ranged-for loops over the whitelists access by const-ref
2020-09-08 18:04:54 -07:00
Jon Siwek
260895fcb1 Merge remote-tracking branch 'origin/topic/robin/gh-343-http-sigs'
* origin/topic/robin/gh-343-http-sigs:
  Change HTTP's DPD signatures so that each side can trigger the analyzer on its own.
2020-09-08 17:24:29 -07:00
Jon Siwek
991bbc961d Merge remote-tracking branch 'origin/topic/robin/gh-623-sampling'
- Merge adjustments:
  - Minor whitespace/style tweaks
  - Fixed portability of the btest due to differences in `uniq -c`
    output format

* origin/topic/robin/gh-623-sampling:
  Extend weird sampling with option to track selected weirds globally.
2020-09-08 17:06:40 -07:00
Robin Sommer
0af57d12b2 Change HTTP's DPD signatures so that each side can trigger the analyzer on its own.
This is to avoid missing large sessions where a single side exceeds
the DPD buffer size. It comes with the trade-off that now the analyzer
can be triggered by anybody controlling one of the endpoints (instead
of both).

Test suite changes are minor, and nothing in "external".

Closes #343.
2020-09-08 07:33:36 +00:00
Robin Sommer
5fa94973da Extend weird sampling with option to track selected weirds globally.
The new set "sampling_global_list" lists weirds to rate-limite
globally instead of per connection/flow.

Closes #623.
2020-09-07 07:31:22 +00:00
zeek-bot
a00b712e39 Update doc submodule [nomail] [skip ci] 2020-09-06 00:36:46 +00:00
Jon Siwek
90f04c3d0a Merge remote-tracking branch 'origin/topic/jsiwek/exclude-installing-zeek-symlink'
* origin/topic/jsiwek/exclude-installing-zeek-symlink:
  Exclude installing "zeek -> ." include dir symlink
2020-09-04 18:30:38 -07:00
Jon Siwek
2a8de33c63 Merge remote-tracking branch 'origin/topic/jsiwek/gh-1122'
* origin/topic/jsiwek/gh-1122:
  GH-165: Fix global initializations that indirectly use builtin types
  Improve how primary/top-level BIFs get initialized
  GH-1122: Allow initializing globals with calls to subdir BIFs
  GH-1122: Improve error for global record initialization exceptions
2020-09-04 17:24:50 -07:00
Jon Siwek
bc3df06737 Exclude installing "zeek -> ." include dir symlink
The symlink only exists for use within the source-tree and isn't needed
for the install-tree.
2020-09-04 16:41:46 -07:00
Jon Siwek
319556fa36 Update submodule(s)
[nomail]
2020-09-03 20:45:22 -07:00
Jon Siwek
c7408482b4 Change a script comment to use "code-block" directive 2020-09-03 15:03:12 -07:00
Jon Siwek
48e2445600 Merge remote-tracking branch 'origin/topic/jsiwek/skip-ci-benchmark'
* origin/topic/jsiwek/skip-ci-benchmark:
  Improve CI benchmark script's error handling/messaging
2020-09-02 20:51:35 -07:00
Christian Kreibich
bdd624d8b8 Avoid passing address of member in packed struct #1074
This appeases -Waddress-of-packed-member warnings in some
compiler/platform combinations via use of local variables.
2020-09-02 16:04:26 -07:00
Johanna Amann
425b6104c5 Merge remote-tracking branch 'origin/topic/jsiwek/gh-955-prohibit-typecasting-switch-fallthrough'
* origin/topic/jsiwek/gh-955-prohibit-typecasting-switch-fallthrough:
  GH-955: Prohibit `fallthrough` in typecasting `switch` cases

Closes GH-955
2020-09-02 11:49:28 -07:00
Jon Siwek
efcdacda98 Switch generate-docs action to daily schedule 2020-09-01 22:34:11 -07:00
zeek-bot
45577d16bf Update doc submodule [nomail] [skip ci] 2020-09-02 05:26:42 +00:00
Jon Siwek
69fcb789b8 Fix typo in generate-docs action 2020-09-01 22:20:04 -07:00
Jon Siwek
2dc516482a Switch token used for generate-docs action checkout step 2020-09-01 22:08:10 -07:00
Jon Siwek
bcebb80ca6 Add missing git config to generate-docs action 2020-09-01 21:52:39 -07:00
Jon Siwek
e67dae182d Test generate-docs action with cron 2020-09-01 21:40:21 -07:00
Jon Siwek
7865e38134 Fix generate-docs action to not fail when there's no changes 2020-09-01 20:34:47 -07:00
Jon Siwek
d51e0f73b7 Update generate-docs action to use access token for submodule update 2020-09-01 19:50:44 -07:00
Jon Siwek
49de7199d7 Update generate-docs action to install Sphinx dependency 2020-09-01 18:38:24 -07:00