[Forensics-changes] [yara] 78/160: PE module: avoid segfault after failed allocation.

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:29:20 UTC 2017


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag v3.4.0
in repository yara.

commit 01fd0f6ef91646a5aae61aa9de8d262b9831eb48
Author: Hilko Bengen <bengen at hilluzination.de>
Date:   Wed Apr 15 23:42:16 2015 +0200

    PE module: avoid segfault after failed allocation.
    
    Found using afl-fuzz
---
 libyara/modules/pe.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libyara/modules/pe.c b/libyara/modules/pe.c
index 8a99546..9824515 100644
--- a/libyara/modules/pe.c
+++ b/libyara/modules/pe.c
@@ -849,6 +849,9 @@ IMPORTED_FUNCTION* pe_parse_import_descriptor(
         IMPORTED_FUNCTION* imported_func = (IMPORTED_FUNCTION*)
             yr_calloc(1, sizeof(IMPORTED_FUNCTION));
 
+        if (!imported_func)
+          continue;
+
         imported_func->name = name;
         imported_func->next = NULL;
 
@@ -902,6 +905,9 @@ IMPORTED_FUNCTION* pe_parse_import_descriptor(
         IMPORTED_FUNCTION* imported_func = (IMPORTED_FUNCTION*)
             yr_calloc(1, sizeof(IMPORTED_FUNCTION));
 
+        if (!imported_func)
+          continue;
+
         imported_func->name = name;
         imported_func->next = NULL;
 

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