summaryrefslogtreecommitdiff
path: root/libmpx/mpxwrap
diff options
context:
space:
mode:
authorIlya Enkovich <ilya.enkovich@intel.com>2015-04-09 10:11:30 +0000
committerIlya Enkovich <ienkovich@gcc.gnu.org>2015-04-09 10:11:30 +0000
commit3ba99d8a035e95aa93eb2fc56739f63c36582213 (patch)
tree197c099455b92c4fccdc2a89f6f4d5cbb0d7ae2d /libmpx/mpxwrap
parent54414978ae4085ffce4bb00d802e29e35ed6d6b3 (diff)
downloadgcc-3ba99d8a035e95aa93eb2fc56739f63c36582213.tar.gz
mpx_wrappers.c (__mpx_wrapper_memmove): Add zero length check.
libmpx/ * mpxwrap/mpx_wrappers.c (__mpx_wrapper_memmove): Add zero length check. gcc/testsuite/ * gcc.target/i386/mpx/memmove-zero-length.c: New. From-SVN: r221944
Diffstat (limited to 'libmpx/mpxwrap')
-rw-r--r--libmpx/mpxwrap/mpx_wrappers.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libmpx/mpxwrap/mpx_wrappers.c b/libmpx/mpxwrap/mpx_wrappers.c
index ef4be8d0a39..58670aae481 100644
--- a/libmpx/mpxwrap/mpx_wrappers.c
+++ b/libmpx/mpxwrap/mpx_wrappers.c
@@ -97,6 +97,9 @@ __mpx_wrapper_memmove (void *dst, const void *src, size_t n)
size_t offset_src = ((size_t) s) & (sizeof (void *) - 1);
size_t offset_dst = ((size_t) d) & (sizeof (void *) - 1);
+ if (n == 0)
+ return ret;
+
__bnd_chk_ptr_bounds (dst, n);
__bnd_chk_ptr_bounds (src, n);