diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-03-25 15:09:56 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-03-25 23:49:35 +0000 |
commit | 494508f2d02d8380c4060354fa06de6a3de417f4 (patch) | |
tree | 232c6a465fdb808e27430192e3b653dca8de5bae /epan/except.c | |
parent | 6a75c59a22b1ec6b0d34dbe90b85a5ca275bc680 (diff) |
Clean up REPORT_DISSECTOR_BUG().
Have it take a format and argument list as arguments, and have the
formatting done inside the reporting code. That way, we're not relying
on any particular wmem scope working.
If WIRESHARK_ABORT_ON_DISSECTOR_BUG is set, try to add the message to
the crash information (currently only supported in macOS), and print it
to the standard error, before crashing. We won't necessarily have a
usable crash dump to analyze, so we can't rely on that to find the cause
of the crash.
Ping-Bug: 14490
Change-Id: I2b39169c45c84f2ada31efa1d413bd28c140f8f4
Reviewed-on: https://code.wireshark.org/review/26643
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/except.c')
-rw-r--r-- | epan/except.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/epan/except.c b/epan/except.c index 2420b33760..dc95301d51 100644 --- a/epan/except.c +++ b/epan/except.c @@ -309,15 +309,22 @@ WS_NORETURN void except_throwd(long group, long code, const char *msg, void *dat * XCEPT_BUFFER_SIZE? We could then just use this to generate formatted * messages. */ -WS_NORETURN void except_throwf(long group, long code, const char *fmt, ...) +WS_NORETURN void except_vthrowf(long group, long code, const char *fmt, + va_list vl) { char *buf = (char *)except_alloc(XCEPT_BUFFER_SIZE); + + g_vsnprintf(buf, XCEPT_BUFFER_SIZE, fmt, vl); + except_throwd(group, code, buf, buf); +} + +WS_NORETURN void except_throwf(long group, long code, const char *fmt, ...) +{ va_list vl; va_start (vl, fmt); - g_vsnprintf(buf, XCEPT_BUFFER_SIZE, fmt, vl); + except_vthrowf(group, code, fmt, vl); va_end (vl); - except_throwd(group, code, buf, buf); } void (*except_unhandled_catcher(void (*new_catcher)(except_t *)))(except_t *) |