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.
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
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
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
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.
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.
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.
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
...
* 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