[Forensics-changes] [yara] 29/135: Fix issue with files larger than 4GB

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


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

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

commit f6d91d73afbcc9f935cfd3e0d3e79d30ffc3c527
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Mon Jun 2 10:20:38 2014 +0200

    Fix issue with files larger than 4GB
---
 libyara/filemap.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/libyara/filemap.c b/libyara/filemap.c
index e3cf5ed..407fcd4 100755
--- a/libyara/filemap.c
+++ b/libyara/filemap.c
@@ -37,6 +37,8 @@ int yr_filemap_map(
     const char* file_path,
     MAPPED_FILE* pmapped_file)
 {
+  LARGE_INTEGER size;
+
   if (file_path == NULL)
     return ERROR_INVALID_ARGUMENT;
 
@@ -52,7 +54,19 @@ int yr_filemap_map(
   if (pmapped_file->file == INVALID_HANDLE_VALUE)
     return ERROR_COULD_NOT_OPEN_FILE;
 
-  pmapped_file->size = GetFileSize(pmapped_file->file, NULL);
+  if (GetFileSizeEx(pmapped_file->file, &size))
+  {
+    #ifdef _WIN64
+    pmapped_file->size = size.QuadPart;
+    #else
+    pmapped_file->size = size.LowPart;
+    #endif
+  }
+  else
+  {
+    CloseHandle(pmapped_file->file);
+    return ERROR_COULD_NOT_OPEN_FILE;
+  }
 
   if (pmapped_file->size == 0)
   {

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