Merge remote-tracking branch 'origin/topic/jsiwek/gh-1024-broker-store-handle-type-checks'

* origin/topic/jsiwek/gh-1024-broker-store-handle-type-checks:
  Improve Broker store API's handling of invalid arguments
  Add builtin_exception() functions
  GH-1024: fix crash on passing wrong types to Broker store API

This was a bit of a bigger merge since Zeek changed inbetween the time
of the PR and me actually merging it.

I put the new functions into the zeek::detail namespace -- since it
seems unlikely that those will be used by something external.

I also renamed them to fit better with the naming scheme of the new
error functions.

Fixes GH-1024
This commit is contained in:
Johanna Amann 2020-07-14 00:02:05 +00:00
commit da2c968ba0
7 changed files with 243 additions and 116 deletions

View file

@ -275,13 +275,17 @@ extern std::vector<CallInfo> call_stack;
// This is set to true after the built-in functions have been initialized.
extern bool did_builtin_init;
extern void emit_builtin_exception(const char* msg);
extern void emit_builtin_exception(const char* msg, const zeek::ValPtr& arg);
extern void emit_builtin_exception(const char* msg, Obj* arg);
} // namespace detail
extern std::string render_call_stack();
// These methods are used by BIFs, so they're in the public namespace.
extern void emit_builtin_error(const char* msg);
extern void emit_builtin_error(const char* msg, zeek::ValPtr);
extern void emit_builtin_error(const char* msg, const zeek::ValPtr&);
extern void emit_builtin_error(const char* msg, Obj* arg);
} // namespace zeek