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
This commit is contained in:
parent
54414978ae
commit
3ba99d8a03
@ -1,3 +1,7 @@
|
||||
2015-04-09 Ilya Enkovich <ilya.enkovich@intel.com>
|
||||
|
||||
* gcc.target/i386/mpx/memmove-zero-length.c: New.
|
||||
|
||||
2015-04-09 Kirill Yukhin <kirill.yukhin@intel.com>
|
||||
|
||||
PR target/65676
|
||||
|
18
gcc/testsuite/gcc.target/i386/mpx/memmove-zero-length.c
Normal file
18
gcc/testsuite/gcc.target/i386/mpx/memmove-zero-length.c
Normal file
@ -0,0 +1,18 @@
|
||||
/* { dg-do run } */
|
||||
/* { dg-options "-fcheck-pointer-bounds -mmpx" } */
|
||||
|
||||
|
||||
#include "mpx-check.h"
|
||||
#include "string.h"
|
||||
|
||||
int mpx_test (int argc, const char **argv)
|
||||
{
|
||||
int *buf = (int *)malloc (100 * sizeof(int));
|
||||
|
||||
memmove (buf, NULL, 0);
|
||||
memmove (NULL, buf, 0);
|
||||
|
||||
free (buf);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,3 +1,8 @@
|
||||
2015-04-09 Ilya Enkovich <ilya.enkovich@intel.com>
|
||||
|
||||
* mpxwrap/mpx_wrappers.c (__mpx_wrapper_memmove): Add
|
||||
zero length check.
|
||||
|
||||
2015-04-02 Ilya Enkovich <ilya.enkovich@intel.com>
|
||||
|
||||
PR driver/65444
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user