Commit graph

10798 commits

Author SHA1 Message Date
Max Kellermann
36a26a7b43 Attr: use class IntrusivePtr 2020-03-06 12:59:47 +01:00
Max Kellermann
097a362c80 Expr: check_and_promote_expr() returns IntrusivePtr
Instead of returning a pseudo-boolean integer, it now returns a
referenced object or nullptr on error.  The old API was very error
prone because of its obscure reference counting semantics.
2020-03-06 09:39:30 +01:00
Max Kellermann
78e736621c Frame: use class IntrusivePtr 2020-03-06 09:12:03 +01:00
Max Kellermann
79570fdfd6 Val: RecordVal::LookupWithDefault() returns IntrusivePtr 2020-03-06 09:06:46 +01:00
Max Kellermann
d180ab0dd2 Type: RecordType::FieldDefault() returns IntrusivePtr
Fixes memory leak in EventHandler::NewEvent().
2020-03-06 09:06:45 +01:00
Max Kellermann
d2961c72e1 Val: TableVal::Delete() returns IntrusivePtr 2020-03-06 09:06:38 +01:00
Max Kellermann
6495193aae Type: base_type() returns IntrusivePtr 2020-03-06 09:06:38 +01:00
Max Kellermann
f0a357cadf Type: init_type() returns IntrusivePtr 2020-03-06 09:06:38 +01:00
Max Kellermann
cf11d78483 Type: merge_types() returns IntrusivePtr 2020-03-06 09:06:38 +01:00
Max Kellermann
50d53b2973 Type: use class IntrusivePtr in VectorType 2020-03-06 09:06:38 +01:00
Max Kellermann
cc8af19bf9 Type: use class IntrusivePtr in EnumType 2020-03-06 09:06:38 +01:00
Max Kellermann
7704d52d28 Type: use class IntrusivePtr in FileType 2020-03-06 09:06:38 +01:00
Max Kellermann
43af5f8349 Type: use class IntrusivePtr in TypeDecl 2020-03-06 09:06:38 +01:00
Max Kellermann
838bba5206 Type: make TypeDecl final and the dtor non-virtual
Nobody derives from this class.
2020-03-06 09:06:38 +01:00
Max Kellermann
dd74df9c5e Type: use class IntrusivePtr in TypeType 2020-03-06 09:06:38 +01:00
Max Kellermann
184fb9a980 Type: use class IntrusivePtr in FuncType 2020-03-06 09:06:38 +01:00
Max Kellermann
73cea5dcad Type: use class IntrusivePtr in TypeList 2020-03-06 09:06:38 +01:00
Max Kellermann
de0289125b Type: use class IntrusivePtr in IndexType 2020-03-06 09:06:38 +01:00
Max Kellermann
674e141a15 Val: use class IntrusivePtr in class TableVal 2020-03-06 09:06:38 +01:00
Max Kellermann
93c2064b9a Val: use class IntrusivePtr in class TableEntryVal 2020-03-06 09:06:38 +01:00
Max Kellermann
7924e948b9 CompHash: return IntrusivePtr 2020-03-06 09:06:38 +01:00
Max Kellermann
ba35ebec4c Type: return IntrusivePtr 2020-03-06 09:06:38 +01:00
Max Kellermann
0a6ddfb6b5 Val: add TableVal::Assign() overload with IntrusivePtr
Prepare the transition to IntrusivePtr for various callers.
2020-03-06 09:06:38 +01:00
Max Kellermann
78712d009f zeekygen/IdentifierInfo: use class IntrusivePtr more
With this in place, we can eliminate the manually imeplemented copy
constructor/operator.
2020-03-06 09:06:37 +01:00
Max Kellermann
a0c831a1bd Func: use class IntrusivePtr 2020-03-06 09:06:37 +01:00
Max Kellermann
b18573c804 Expr: add missing include for IntrusivePtr<Val>
Fixes build failure with clang.
2020-03-06 09:06:37 +01:00
Max Kellermann
df7a47510a Expr: reference id_list before passing to new BroFunc
Passing the `id_list` pointer to `BroFunc` transfers ownership of the
contained `ID` instances, because `~BroFunc()` unreferences them.
Therefore, we need to increase the reference counters for each
`BroFunc` instance to fix the use-after-free bug.

Closes https://github.com/zeek/zeek/issues/845
2020-03-06 09:06:37 +01:00
Max Kellermann
4d39f53ab2 input/Manager: fix three use-after-free bugs
The code comment said "ref'd by lookupwithdefault", but the `fields`
variable was not referenced; only `fields_val` was, and its reference
was released earlier.

Same for `idx` and `val` in method CreateTableStream().

Fixes a regression from commit d81bfed45d
2020-03-06 08:58:13 +01:00
Jon Siwek
2286865674 Updating submodule(s).
[nomail]
2020-03-05 19:55:28 -08:00
Jon Siwek
26265246c1 Move libkqueue submodule to the aux directory 2020-03-05 19:40:03 -08:00
Jon Siwek
ba9c06fc2b Move rapidjson submodule to aux directory
This also now installs the full rapidjson include/ tree in order to
allow external plugins to properly build if they include
threading/formatters/JSON.h
2020-03-05 19:24:13 -08:00
Jon Siwek
9a8fa25002 Updating submodule(s).
[nomail]
2020-03-05 16:43:08 -08:00
Jon Siwek
363fc49518 Fix a btest to order zeek_init() events via &priority 2020-03-05 14:19:34 -08:00
Vlad Grigorescu
5a1a9ba98e Add support to MySQL for deprecation of EOF packets.
From the docs: "As of MySQL 5.7.5, OK packes are also used to indicate
EOF, and EOF packets are deprecated."

The client sets a capability flag (CLIENT_DEPRECATE_EOF) to indicate
that it expects an OK instead of an EOF after the resultset rows.
2020-03-05 12:18:31 -06:00
Vlad Grigorescu
c38e1fa91a Whitespace cleanup & fixes
[nomail]
2020-03-05 11:50:41 -06:00
Vlad Grigorescu
d961e21185 Fix EOF detection in the MySQL protocol analyzer.
The MySQL
documentation (https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_basic_eof_packet.html)
warns us that "You must check whether the packet length is less than 9
to make sure that it is a EOF_Packet packet."

While we were doing this in two places, we were comparing the total
packet length, which includes the 4-byte header. Changed to compare to
13 instead.
2020-03-05 11:35:27 -06:00
Jon Siwek
1b252038c5 Updating submodule(s).
[nomail]
2020-03-02 11:41:54 -08:00
Jon Siwek
77a3f294bc Updating submodule(s).
[nomail]
2020-03-02 10:58:53 -08:00
Jon Siwek
202fff1003 Updating submodule(s).
[nomail]
2020-03-02 10:57:33 -08:00
Jon Siwek
ea4ca815c6 Updating submodule(s).
[nomail]
2020-03-02 10:34:21 -08:00
Jon Siwek
d43e3c13be Stop running GitHub Actions in forked repos 2020-03-02 09:20:41 -08:00
Jon Siwek
58ce0321b0 Remove Travis CI configuration 2020-02-28 21:17:02 -08:00
Jon Siwek
695a4b9a85 Add GitHub Action for Coverity Scan 2020-02-28 21:16:11 -08:00
Jon Siwek
b324fecc0d GH-831: Fix the "bro" symlink for binary packaging mode
Creating a "bro" symlink inside the build tree was just to support older
packages/plugins that depended on the build tree, but that's never
available to users in the context of binary packages anyway and also has
the negative effect of clobberring what a previous InstallSymlink() call
intended to use for that symlink in binary packaging mode.
2020-02-28 17:27:47 -08:00
Jon Siwek
f69aa03923 Updating submodule(s).
[nomail]
2020-02-28 13:27:19 -08:00
Jon Siwek
30a794cf5f Merge branch 'queue_lock' of https://github.com/MaxKellermann/zeek
* 'queue_lock' of https://github.com/MaxKellermann/zeek:
  threading/Queue: lock mutex before notifying the condition_variable
2020-02-28 11:39:10 -08:00
Jon Siwek
cf196bb148 Merge branch 'leaks' of https://github.com/MaxKellermann/zeek
Only one instance of base_type() getting a NewRef instead of AdoptRef
fixed in merge.  All other changes are superficial formatting and
factoring.

* 'leaks' of https://github.com/MaxKellermann/zeek: (22 commits)
  Stmt: use class IntrusivePtr
  Stmt: remove unused default constructors and `friend` declarations
  Val: remove unimplemented prototype recover_val()
  Val: cast_value_to_type() returns IntrusivePtr
  Val: use IntrusivePtr in check_and_promote()
  Val: use nullptr instead of 0
  zeekygen: use class IntrusivePtr
  ID: use class IntrusivePtr
  Expr: use class IntrusivePtr
  Var: copy Location to stack, to fix use-after-free crash bug
  Scope: lookup_ID() and install_ID() return IntrusivePtr<ID>
  Scope: delete duplicate locals
  EventRegistry: automatically delete EventHandlers
  main: destroy event_registry after iosource_mgr
  zeekygen/IdentifierInfo: delete duplicate fields
  main: free the global scope in terminate_bro()
  Scope: pop_scope() returns IntrusivePtr<>
  Scope: unref all inits in destructor
  Var: pass IntrusivePtr to add_global(), add_local() etc.
  plugin/ComponentManager: hold a reference to the EnumType
  ...
2020-02-28 00:48:20 -08:00
Jon Siwek
646a2313ae Merge remote-tracking branch 'origin/topic/timw/cleanup'
* origin/topic/timw/cleanup:
  Expr: use fmt instead of sprintf
  Expr: other minor initialization cleanup
  Expr: use List::empty()
  Expr: Convert a bunch of methods returning ints to return bools
  IPAddr: minor cleanup
  PriorityQueue: initialization cleanup
  IP: Cleanup initialization, make a few functions consistent with others
2020-02-27 14:25:37 -08:00
Tim Wojtulewicz
33aa192cec Expr: use fmt instead of sprintf 2020-02-27 14:21:18 -07:00
Tim Wojtulewicz
c466e63493 Expr: other minor initialization cleanup 2020-02-27 14:21:18 -07:00