| 1 |
/* bridge.cc -- extern "C" wrappers around sanitizer_common APIs. |
| 2 |
Copyright (C) 2013 Free Software Foundation, Inc. |
| 3 |
Written by Jakub Jelinek, Red Hat, Inc. |
| 4 |
|
| 5 |
Redistribution and use in source and binary forms, with or without |
| 6 |
modification, are permitted provided that the following conditions are |
| 7 |
met: |
| 8 |
|
| 9 |
(1) Redistributions of source code must retain the above copyright |
| 10 |
notice, this list of conditions and the following disclaimer. |
| 11 |
|
| 12 |
(2) Redistributions in binary form must reproduce the above copyright |
| 13 |
notice, this list of conditions and the following disclaimer in |
| 14 |
the documentation and/or other materials provided with the |
| 15 |
distribution. |
| 16 |
|
| 17 |
(3) The name of the author may not be used to |
| 18 |
endorse or promote products derived from this software without |
| 19 |
specific prior written permission. |
| 20 |
|
| 21 |
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 22 |
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 23 |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 24 |
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
| 25 |
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 26 |
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 27 |
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 28 |
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 29 |
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 30 |
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 31 |
POSSIBILITY OF SUCH DAMAGE. */ |
| 32 |
|
| 33 |
#include "config.h" |
| 34 |
|
| 35 |
#include <string.h> |
| 36 |
|
| 37 |
#include "sanitizer_common/sanitizer_allocator_internal.h" |
| 38 |
|
| 39 |
extern "C" |
| 40 |
{ |
| 41 |
|
| 42 |
void * |
| 43 |
__asan_internal_memcpy (void *dest, const void *src, size_t n) |
| 44 |
{ |
| 45 |
return __sanitizer::internal_memcpy (dest, src, n); |
| 46 |
} |
| 47 |
|
| 48 |
void * |
| 49 |
__asan_internal_memset (void *dest, int c, size_t n) |
| 50 |
{ |
| 51 |
return __sanitizer::internal_memset (dest, c, n); |
| 52 |
} |
| 53 |
|
| 54 |
int |
| 55 |
__asan_internal_memcmp (const void *s1, const void *s2, size_t n) |
| 56 |
{ |
| 57 |
return __sanitizer::internal_memcmp (s1, s2, n); |
| 58 |
} |
| 59 |
|
| 60 |
int |
| 61 |
__asan_internal_strcmp (const char *s1, const char *s2) |
| 62 |
{ |
| 63 |
return __sanitizer::internal_strcmp (s1, s2); |
| 64 |
} |
| 65 |
|
| 66 |
int |
| 67 |
__asan_internal_strncmp (const char *s1, const char *s2, size_t n) |
| 68 |
{ |
| 69 |
return __sanitizer::internal_strncmp (s1, s2, n); |
| 70 |
} |
| 71 |
|
| 72 |
size_t |
| 73 |
__asan_internal_strlen (const char *str) |
| 74 |
{ |
| 75 |
return __sanitizer::internal_strlen (str); |
| 76 |
} |
| 77 |
|
| 78 |
size_t |
| 79 |
__asan_internal_strnlen (const char *str, size_t n) |
| 80 |
{ |
| 81 |
return __sanitizer::internal_strnlen (str, n); |
| 82 |
} |
| 83 |
|
| 84 |
} |