[Forensics-changes] [yara] 60/192: Exception handler (Unix): Install a handler for SIGSEGV (#552)
Hilko Bengen
bengen at moszumanska.debian.org
Sat Jul 1 10:31:46 UTC 2017
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag v3.6.0
in repository yara.
commit 35f01653ab162d4302faebcfa36b349b4141344a
Author: Hilko Bengen <hillu at users.noreply.github.com>
Date: Wed Nov 2 09:23:15 2016 +0100
Exception handler (Unix): Install a handler for SIGSEGV (#552)
test-exception now passes on FreeBSD11/amd64, OpenBSD6/amd64.
Closes #551
---
libyara/exception.h | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/libyara/exception.h b/libyara/exception.h
index c70ae63..a9698b3 100644
--- a/libyara/exception.h
+++ b/libyara/exception.h
@@ -81,7 +81,7 @@ static LONG CALLBACK exception_handler(
sigjmp_buf *exc_jmp_buf[MAX_THREADS];
static void exception_handler(int sig) {
- if (sig == SIGBUS)
+ if (sig == SIGBUS || sig == SIGSEGV)
{
int tidx = yr_get_tidx();
@@ -97,12 +97,14 @@ typedef struct sigaction sa;
#define YR_TRYCATCH(_try_clause_, _catch_clause_) \
do \
{ \
- struct sigaction oldact; \
+ struct sigaction old_sigbus_act; \
+ struct sigaction old_sigsegv_act; \
struct sigaction act; \
act.sa_handler = exception_handler; \
act.sa_flags = 0; /* SA_ONSTACK? */ \
sigfillset(&act.sa_mask); \
- sigaction(SIGBUS, &act, &oldact); \
+ sigaction(SIGBUS, &act, &old_sigbus_act); \
+ sigaction(SIGSEGV, &act, &old_sigsegv_act); \
int tidx = yr_get_tidx(); \
assert(tidx != -1); \
sigjmp_buf jb; \
@@ -112,7 +114,8 @@ typedef struct sigaction sa;
else \
{ _catch_clause_ } \
exc_jmp_buf[tidx] = NULL; \
- sigaction(SIGBUS, &oldact, NULL); \
+ sigaction(SIGBUS, &old_sigbus_act, NULL); \
+ sigaction(SIGSEGV, &old_sigsegv_act, NULL); \
} while (0)
#endif
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git
More information about the forensics-changes
mailing list