summaryrefslogtreecommitdiff
path: root/src/lib/evil
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2019-09-12 10:01:33 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-09-12 10:01:33 -0400
commitc00d70982fd3fbbb3fd429ddfa2b1d143f7ac9f0 (patch)
tree8122c5aed8a383f9abf24f6e56175131a350bbc3 /src/lib/evil
parent3307e558740d84577b2eb72e1fd7abc2e2946a5c (diff)
Evil: fix mmap() and define HAVE_MMAP
Summary: add size of file mapping to fix invalid parameter Test Plan: compilation (edje succeeds) and elm_test Reviewers: zmike, cedric, raster Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9913
Diffstat (limited to 'src/lib/evil')
-rw-r--r--src/lib/evil/evil_dlfcn.h2
-rw-r--r--src/lib/evil/evil_mman.c12
-rw-r--r--src/lib/evil/evil_mman.h4
-rw-r--r--src/lib/evil/evil_stdlib.h2
4 files changed, 17 insertions, 3 deletions
diff --git a/src/lib/evil/evil_dlfcn.h b/src/lib/evil/evil_dlfcn.h
index c6d5d1a..9e39be5 100644
--- a/src/lib/evil/evil_dlfcn.h
+++ b/src/lib/evil/evil_dlfcn.h
@@ -144,7 +144,7 @@ struct Dl_info
144 */ 144 */
145EAPI void *dlopen(const char* path, int mode); 145EAPI void *dlopen(const char* path, int mode);
146#ifndef HAVE_DLOPEN 146#ifndef HAVE_DLOPEN
147#define HAVE_DLOPEN 1 147# define HAVE_DLOPEN 1
148#endif 148#endif
149/** 149/**
150 * @brief Close a dynamic-link library. 150 * @brief Close a dynamic-link library.
diff --git a/src/lib/evil/evil_mman.c b/src/lib/evil/evil_mman.c
index dbcfc31..42f8021 100644
--- a/src/lib/evil/evil_mman.c
+++ b/src/lib/evil/evil_mman.c
@@ -58,6 +58,8 @@ mmap(void *addr EVIL_UNUSED,
58 DWORD acs = 0; 58 DWORD acs = 0;
59 HANDLE handle; 59 HANDLE handle;
60 void *data; 60 void *data;
61 DWORD low;
62 DWORD high;
61 63
62 /* get protection */ 64 /* get protection */
63 protect = _evil_mmap_protection_get(prot); 65 protect = _evil_mmap_protection_get(prot);
@@ -89,7 +91,15 @@ mmap(void *addr EVIL_UNUSED,
89 } 91 }
90 } 92 }
91 93
92 fm = CreateFileMapping(handle, NULL, protect, 0, 0, NULL); 94#ifdef _WIN64
95 low = (DWORD)((len >> 32) & 0x00000000ffffffff);
96 low = (DWORD)(len & 0x00000000ffffffff);
97#else
98 high = 0L;
99 low = len;
100#endif
101
102 fm = CreateFileMapping(handle, NULL, protect, high, low, NULL);
93 if (!fm) 103 if (!fm)
94 { 104 {
95 fprintf(stderr, "[Evil] [mmap] CreateFileMapping failed: %s\n", 105 fprintf(stderr, "[Evil] [mmap] CreateFileMapping failed: %s\n",
diff --git a/src/lib/evil/evil_mman.h b/src/lib/evil/evil_mman.h
index 990d146..747917d 100644
--- a/src/lib/evil/evil_mman.h
+++ b/src/lib/evil/evil_mman.h
@@ -114,6 +114,10 @@ EAPI void *mmap(void *addr,
114 int fd, 114 int fd,
115 off_t offset); 115 off_t offset);
116 116
117#ifndef HAVE_MMAP
118# define HAVE_MMAP 1
119#endif
120
117/** 121/**
118 * Unmaps a mapped view of a file from the calling process's 122 * Unmaps a mapped view of a file from the calling process's
119 * address space. 123 * address space.
diff --git a/src/lib/evil/evil_stdlib.h b/src/lib/evil/evil_stdlib.h
index a5645b7..eae2fb8 100644
--- a/src/lib/evil/evil_stdlib.h
+++ b/src/lib/evil/evil_stdlib.h
@@ -116,7 +116,7 @@ EAPI int mkstemps(char *__template, int suffixlen);
116 */ 116 */
117EAPI char *realpath(const char *file_name, char *resolved_name); 117EAPI char *realpath(const char *file_name, char *resolved_name);
118#ifndef HAVE_REALPATH 118#ifndef HAVE_REALPATH
119#define HAVE_REALPATH 1 119# define HAVE_REALPATH 1
120#endif 120#endif
121 121
122 122