[Forensics-changes] [yara] 16/192: Better error reporting for regexps exceeding RE_MAX_SPLIT_ID

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:31:41 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 5122eb96201b07cd9643bbbc51c625112b3f455e
Author: plusvic <plusvic at gmail.com>
Date:   Fri Aug 26 10:43:54 2016 +0200

    Better error reporting for regexps exceeding RE_MAX_SPLIT_ID
---
 libyara/compiler.c           | 5 +++++
 libyara/include/yara/error.h | 1 +
 libyara/re.c                 | 2 +-
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/libyara/compiler.c b/libyara/compiler.c
index dd4c251..4c0fdeb 100644
--- a/libyara/compiler.c
+++ b/libyara/compiler.c
@@ -959,6 +959,11 @@ YR_API char* yr_compiler_get_error_message(
           buffer_size,
           "regular expression is too large");
       break;
+    case ERROR_REGULAR_EXPRESSION_TOO_COMPLEX:
+      snprintf(
+          buffer,
+          buffer_size,
+          "regular expression is too complex");
 
   }
 
diff --git a/libyara/include/yara/error.h b/libyara/include/yara/error.h
index 75d56ed..a5476b0 100644
--- a/libyara/include/yara/error.h
+++ b/libyara/include/yara/error.h
@@ -87,6 +87,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #define ERROR_TOO_MANY_RE_FIBERS                46
 #define ERROR_COULD_NOT_READ_PROCESS_MEMORY     47
 #define ERROR_INVALID_EXTERNAL_VARIABLE_TYPE    48
+#define ERROR_REGULAR_EXPRESSION_TOO_COMPLEX    49
 
 
 #define FAIL_ON_ERROR(x) { \
diff --git a/libyara/re.c b/libyara/re.c
index a33d989..a0cf4f9 100644
--- a/libyara/re.c
+++ b/libyara/re.c
@@ -650,7 +650,7 @@ int _yr_emit_split(
   assert(opcode == RE_OPCODE_SPLIT_A || opcode == RE_OPCODE_SPLIT_B);
 
   if (emit_context->next_split_id == RE_MAX_SPLIT_ID)
-    return ERROR_INTERNAL_FATAL_ERROR;
+    return ERROR_REGULAR_EXPRESSION_TOO_COMPLEX;
 
   FAIL_ON_ERROR(yr_arena_write_data(
       emit_context->arena,

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