bridge.cc 2.4 KB

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