|
|
383a11 |
*** a/Makefile.am 2014-05-29 10:40:14.997714171 -0600
|
|
|
383a11 |
--- b/Makefile.am 2014-05-29 12:42:18.358166208 -0600
|
|
|
383a11 |
*************** libmemstomp_la_LIBADD = \
|
|
|
383a11 |
*** 53,58 ****
|
|
|
383a11 |
--- 53,60 ----
|
|
|
383a11 |
-ldl
|
|
|
383a11 |
libmemstomp_la_CFLAGS = \
|
|
|
383a11 |
$(PTHREAD_CFLAGS) \
|
|
|
383a11 |
+ -fno-tree-vrp \
|
|
|
383a11 |
+ -fno-delete-null-pointer-checks \
|
|
|
383a11 |
-DSONAME=\"libmemstomp.so\"
|
|
|
383a11 |
|
|
|
383a11 |
libmemstomp_backtrace_symbols_la_SOURCES = \
|
|
|
383a11 |
*************** libmemstomp_backtrace_symbols_la_LIBADD
|
|
|
383a11 |
*** 68,74 ****
|
|
|
383a11 |
-lrt \
|
|
|
383a11 |
-ldl
|
|
|
383a11 |
libmemstomp_backtrace_symbols_la_CFLAGS = \
|
|
|
383a11 |
! $(PTHREAD_CFLAGS)
|
|
|
383a11 |
|
|
|
383a11 |
memstomp: memstomp.in Makefile
|
|
|
383a11 |
sed -e 's,@PACKAGE_STRING\@,$(PACKAGE_STRING),g' \
|
|
|
383a11 |
--- 70,76 ----
|
|
|
383a11 |
-lrt \
|
|
|
383a11 |
-ldl
|
|
|
383a11 |
libmemstomp_backtrace_symbols_la_CFLAGS = \
|
|
|
383a11 |
! $(PTHREAD_CFLAGS)
|
|
|
383a11 |
|
|
|
383a11 |
memstomp: memstomp.in Makefile
|
|
|
383a11 |
sed -e 's,@PACKAGE_STRING\@,$(PACKAGE_STRING),g' \
|
|
|
383a11 |
*** a/memstomp.c 2014-05-29 10:40:15.016714123 -0600
|
|
|
383a11 |
--- b/memstomp.c 2014-05-29 13:59:20.314343481 -0600
|
|
|
383a11 |
***************
|
|
|
383a11 |
*** 62,67 ****
|
|
|
383a11 |
--- 62,79 ----
|
|
|
383a11 |
#define likely(x) __builtin_expect(!!(x), 1)
|
|
|
383a11 |
#define unlikely(x) __builtin_expect(!!(x), 0)
|
|
|
383a11 |
|
|
|
383a11 |
+ #undef strcmp
|
|
|
383a11 |
+ #undef strncmp
|
|
|
383a11 |
+ #undef strdup
|
|
|
383a11 |
+ #undef strndup
|
|
|
383a11 |
+ #undef strchr
|
|
|
383a11 |
+ #undef strrchr
|
|
|
383a11 |
+ #undef strcspn
|
|
|
383a11 |
+ #undef strspn
|
|
|
383a11 |
+ #undef strpbrk
|
|
|
383a11 |
+ #undef strtok_r
|
|
|
383a11 |
+ #undef memcmp
|
|
|
383a11 |
+
|
|
|
383a11 |
static bool abrt_trap = false;
|
|
|
383a11 |
|
|
|
383a11 |
static bool quiet_mode = false;
|
|
|
383a11 |
*************** static void warn_copylap(void * dest, co
|
|
|
383a11 |
*** 316,321 ****
|
|
|
383a11 |
--- 328,356 ----
|
|
|
383a11 |
free(info);
|
|
|
383a11 |
}
|
|
|
383a11 |
|
|
|
383a11 |
+ static void warn_null(char const *name)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ char prname[17];
|
|
|
383a11 |
+ char buf[160];
|
|
|
383a11 |
+
|
|
|
383a11 |
+ /* Avoid fprintf which is not async signal safe. fprintf may call malloc,
|
|
|
383a11 |
+ * which may experience trouble if the bad memcpy was called from a signal
|
|
|
383a11 |
+ * handler whose invoking signal interrupted malloc.
|
|
|
383a11 |
+ */
|
|
|
383a11 |
+ int const j = snprintf(buf, sizeof(buf),
|
|
|
383a11 |
+ "\n\n%s NULL pointer %s(%d)\n",
|
|
|
383a11 |
+ name, get_prname(prname), getpid());
|
|
|
383a11 |
+ write(STDERR_FILENO, buf, umin(j, sizeof(buf)));
|
|
|
383a11 |
+
|
|
|
383a11 |
+ /* If generate_stacktrace() indirectly invokes malloc (such as via libbfd),
|
|
|
383a11 |
+ * then this is not async signal safe. But the write() above will produce
|
|
|
383a11 |
+ * some evidence before any possible trouble below.
|
|
|
383a11 |
+ */
|
|
|
383a11 |
+ char *const info = generate_stacktrace();
|
|
|
383a11 |
+ fprintf(stderr, "%s", info);
|
|
|
383a11 |
+ free(info);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
static void *copy(void *dest, void const *src, size_t count, char const *name)
|
|
|
383a11 |
{
|
|
|
383a11 |
size_t d = (char *)dest - (char *)src;
|
|
|
383a11 |
*************** static void *copy(void *dest, void const
|
|
|
383a11 |
*** 326,331 ****
|
|
|
383a11 |
--- 361,367 ----
|
|
|
383a11 |
/* report the overlap */
|
|
|
383a11 |
warn_copylap(dest, src, count, name);
|
|
|
383a11 |
}
|
|
|
383a11 |
+
|
|
|
383a11 |
/* be safe use memmove */
|
|
|
383a11 |
return memmove(dest, src, count);
|
|
|
383a11 |
}
|
|
|
383a11 |
*************** char *stpncpy(char *dst, char const *src
|
|
|
383a11 |
*** 496,498 ****
|
|
|
383a11 |
--- 532,956 ----
|
|
|
383a11 |
|
|
|
383a11 |
/* XXX wcstok: Ugly! */
|
|
|
383a11 |
|
|
|
383a11 |
+ /* All the interposition routines below are just checking for NULL
|
|
|
383a11 |
+ arguments when ISO demands they be non-null. */
|
|
|
383a11 |
+
|
|
|
383a11 |
+ void *memmove (void *dest, const void *src, size_t n)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static void * (*real_memmove)(void *, const void *, size_t) = NULL;
|
|
|
383a11 |
+ if (!real_memmove)
|
|
|
383a11 |
+ real_memmove = dlsym(RTLD_NEXT, "memmove");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (dest == NULL || src == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("memmove");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_memmove (dest, src, n);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ int memcmp (const void *__s1, const void *__s2, size_t __n)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static int (*real_memcmp)(const void *, const void *, size_t) = NULL;
|
|
|
383a11 |
+ if (!real_memcmp)
|
|
|
383a11 |
+ real_memcmp = dlsym(RTLD_NEXT, "memcmp");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__s1 == NULL || __s2 == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("memcmp");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_memcmp (__s1, __s2, __n);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ int strcmp (const char *__s1, const char *__s2)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static int (*real_strcmp)(const char *, const char *) = NULL;
|
|
|
383a11 |
+ if (!real_strcmp)
|
|
|
383a11 |
+ real_strcmp = dlsym(RTLD_NEXT, "strcmp");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__s1 == NULL || __s2 == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("strcmp");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_strcmp (__s1, __s2);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ int strncmp (const char *__s1, const char *__s2, size_t __n)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static int (*real_strncmp)(const char *, const char *, size_t) = NULL;
|
|
|
383a11 |
+ if (!real_strncmp)
|
|
|
383a11 |
+ real_strncmp = dlsym(RTLD_NEXT, "strncmp");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__s1 == NULL || __s2 == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("strncmp");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_strncmp (__s1, __s2, __n);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ int strcoll (const char *__s1, const char *__s2)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static int (*real_strcoll)(const char *, const char *) = NULL;
|
|
|
383a11 |
+ if (!real_strcoll)
|
|
|
383a11 |
+ real_strcoll = dlsym(RTLD_NEXT, "strcoll");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__s1 == NULL || __s2 == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("strcoll");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_strcoll (__s1, __s2);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ int strcoll_l (const char *__s1, const char *__s2, __locale_t __l)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static int (*real_strcoll_l)(const char *, const char *, __locale_t) = NULL;
|
|
|
383a11 |
+ if (!real_strcoll_l)
|
|
|
383a11 |
+ real_strcoll_l = dlsym(RTLD_NEXT, "strcoll_l");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__s1 == NULL || __s2 == NULL || __l == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("strcoll_l");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_strcoll_l (__s1, __s2, __l);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ size_t strxfrm (char *__dest, const char *__src, size_t __n)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static size_t (*real_strxfrm)(char *, const char *, size_t) = NULL;
|
|
|
383a11 |
+ if (!real_strxfrm)
|
|
|
383a11 |
+ real_strxfrm = dlsym(RTLD_NEXT, "strxfrm");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__src == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("strxfrm");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_strxfrm (__dest, __src, __n);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ size_t strxfrm_l (char *__dest, const char *__src, size_t __n, __locale_t __l)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static size_t (*real_strxfrm_l)(char *, const char *, size_t, __locale_t) = NULL;
|
|
|
383a11 |
+ if (!real_strxfrm_l)
|
|
|
383a11 |
+ real_strxfrm_l = dlsym(RTLD_NEXT, "strxfrm_l");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__src == NULL || __l == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("strxfrm_l");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_strxfrm_l (__dest, __src, __n, __l);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
+ void *memset (void *__s, int __c, size_t __n)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static void * (*real_memset)(void *, int, size_t) = NULL;
|
|
|
383a11 |
+ if (!real_memset)
|
|
|
383a11 |
+ real_memset = dlsym(RTLD_NEXT, "memset");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__s == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("memset");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_memset (__s, __c, __n);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ void *memchr (const void *__s, int __c, size_t __n)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static void * (*real_memchr)(const void *, int, size_t) = NULL;
|
|
|
383a11 |
+ if (!real_memchr)
|
|
|
383a11 |
+ real_memchr = dlsym(RTLD_NEXT, "memchr");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__s == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("memchr");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_memchr (__s, __c, __n);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ void *memrchr (const void *__s, int __c, size_t __n)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static void * (*real_memrchr)(const void *, int, size_t) = NULL;
|
|
|
383a11 |
+ if (!real_memrchr)
|
|
|
383a11 |
+ real_memrchr = dlsym(RTLD_NEXT, "memrchr");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__s == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("memrchr");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_memrchr (__s, __c, __n);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ void *rawmemchr (const void *__s, int __c)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static void * (*real_rawmemchr)(const void *, int, size_t) = NULL;
|
|
|
383a11 |
+ if (!real_rawmemchr)
|
|
|
383a11 |
+ real_rawmemchr = dlsym(RTLD_NEXT, "rawmemchr");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__s == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("rawmemchr");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_rawmemchr (__s, __c, __c);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ size_t strlen (const char *__s)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static size_t (*real_strlen)(const char *) = NULL;
|
|
|
383a11 |
+ if (!real_strlen)
|
|
|
383a11 |
+ real_strlen = dlsym(RTLD_NEXT, "strlen");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__s == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("strlen");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_strlen (__s);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ char *strdup (const char *__s)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static char *(*real_strdup)(const char *) = NULL;
|
|
|
383a11 |
+ if (!real_strdup)
|
|
|
383a11 |
+ real_strdup = dlsym(RTLD_NEXT, "strdup");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__s == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("strdup");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_strdup (__s);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ char *strndup (const char *__s, size_t __n)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static char *(*real_strndup)(const char *, size_t) = NULL;
|
|
|
383a11 |
+ if (!real_strndup)
|
|
|
383a11 |
+ real_strndup = dlsym(RTLD_NEXT, "strndup");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__s == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("strndup");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_strndup (__s, __n);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ char *strchr (const char *__s, int __c)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static char * (*real_strchr)(const void *, int) = NULL;
|
|
|
383a11 |
+ if (!real_strchr)
|
|
|
383a11 |
+ real_strchr = dlsym(RTLD_NEXT, "strchr");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__s == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("strchr");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_strchr (__s, __c);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ char *strrchr (const char *__s, int __c)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static char * (*real_strrchr)(const void *, int) = NULL;
|
|
|
383a11 |
+ if (!real_strrchr)
|
|
|
383a11 |
+ real_strrchr = dlsym(RTLD_NEXT, "strrchr");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__s == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("strrchr");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_strrchr (__s, __c);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ char *strchrnul (const char *__s, int __c)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static char * (*real_strchrnul)(const void *, int) = NULL;
|
|
|
383a11 |
+ if (!real_strchrnul)
|
|
|
383a11 |
+ real_strchrnul = dlsym(RTLD_NEXT, "strchrnul");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__s == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("strchrnul");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_strchrnul (__s, __c);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ size_t strcspn (const char *__s, const char *__reject)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static size_t (*real_strcspn)(const void *, const char *) = NULL;
|
|
|
383a11 |
+ if (!real_strcspn)
|
|
|
383a11 |
+ real_strcspn = dlsym(RTLD_NEXT, "strcspn");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__s == NULL || __reject == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("strcspn");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_strcspn (__s, __reject);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ size_t strspn (const char *__s, const char *__accept)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static size_t (*real_strspn)(const void *, const char *) = NULL;
|
|
|
383a11 |
+ if (!real_strspn)
|
|
|
383a11 |
+ real_strspn = dlsym(RTLD_NEXT, "strspn");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__s == NULL || __accept == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("strspn");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_strspn (__s, __accept);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ char * strpbrk (const char *__s, const char *__accept)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static char * (*real_strpbrk)(const void *, const char *) = NULL;
|
|
|
383a11 |
+ if (!real_strpbrk)
|
|
|
383a11 |
+ real_strpbrk = dlsym(RTLD_NEXT, "strpbrk");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__s == NULL || __accept == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("strpbrk");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_strpbrk (__s, __accept);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ char * strstr (const char *__haystack, const char *__needle)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static char * (*real_strstr)(const void *, const char *) = NULL;
|
|
|
383a11 |
+ if (!real_strstr)
|
|
|
383a11 |
+ real_strstr = dlsym(RTLD_NEXT, "strstr");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__haystack == NULL || __needle == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("strstr");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_strstr (__haystack, __needle);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ char *strcasestr (const char *__haystack, const char *__needle)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static char * (*real_strcasestr)(const void *, const char *) = NULL;
|
|
|
383a11 |
+ if (!real_strcasestr)
|
|
|
383a11 |
+ real_strcasestr = dlsym(RTLD_NEXT, "strcasestr");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__haystack == NULL || __needle == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("strcasestr");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_strcasestr (__haystack, __needle);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ void *memmem (const void *__haystack, size_t __haystacklen,
|
|
|
383a11 |
+ const void *__needle, size_t __needlelen)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static char * (*real_memmem)(const void *, size_t, const char *, size_t) = NULL;
|
|
|
383a11 |
+ if (!real_memmem)
|
|
|
383a11 |
+ real_memmem = dlsym(RTLD_NEXT, "memmem");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__haystack == NULL || __needle == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("memmem");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_memmem (__haystack, __haystacklen, __needle, __needlelen);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ char * strtok (char *__s, const char *__delim)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static char * (*real_strtok)(void *, const char *) = NULL;
|
|
|
383a11 |
+ if (!real_strtok)
|
|
|
383a11 |
+ real_strtok = dlsym(RTLD_NEXT, "strtok");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__delim == NULL)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("strtok");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_strtok (__s, __delim);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
+ char * strtok_r (char *__s, const char *__delim, char **__save_ptr)
|
|
|
383a11 |
+ {
|
|
|
383a11 |
+ static char * (*real_strtok_r)(void *, const char *, char **) = NULL;
|
|
|
383a11 |
+ if (!real_strtok_r)
|
|
|
383a11 |
+ real_strtok_r = dlsym(RTLD_NEXT, "strtok_r");
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if (unlikely (__delim == NULL || __save_ptr)) {
|
|
|
383a11 |
+ if (abrt_trap) ABRT_TRAP;
|
|
|
383a11 |
+ /* report the NULL pointer */
|
|
|
383a11 |
+ warn_null("strtok_r");
|
|
|
383a11 |
+ return 0;
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ return real_strtok_r (__s, __delim, __save_ptr);
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/memccpy.c b/testsuite/memstomp.null/memccpy.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/memccpy.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/memccpy.c 2014-05-29 12:42:18.358166208 -0600
|
|
|
383a11 |
@@ -0,0 +1,20 @@
|
|
|
383a11 |
+#define _GNU_SOURCE
|
|
|
383a11 |
+#include <string.h>
|
|
|
383a11 |
+#include <wchar.h>
|
|
|
383a11 |
+
|
|
|
383a11 |
+#ifndef MEMCCPY
|
|
|
383a11 |
+#define MEMCCPY memccpy
|
|
|
383a11 |
+#define TYPE char
|
|
|
383a11 |
+#endif
|
|
|
383a11 |
+
|
|
|
383a11 |
+TYPE arr1[10] = {0};
|
|
|
383a11 |
+TYPE arr2[10] = {0};
|
|
|
383a11 |
+TYPE *p1 = &arr1[0];
|
|
|
383a11 |
+TYPE *p2 = &arr2[1];
|
|
|
383a11 |
+size_t count = 9;
|
|
|
383a11 |
+main ()
|
|
|
383a11 |
+{
|
|
|
383a11 |
+ MEMCCPY (NULL, NULL, -1, 0);
|
|
|
383a11 |
+}
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/memchr.c b/testsuite/memstomp.null/memchr.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/memchr.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/memchr.c 2014-05-29 14:09:04.667841941 -0600
|
|
|
383a11 |
@@ -0,0 +1,4 @@
|
|
|
383a11 |
+#define MEMSET memchr
|
|
|
383a11 |
+#define TYPE char
|
|
|
383a11 |
+#include "memset.c"
|
|
|
383a11 |
+
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/memcmp.c b/testsuite/memstomp.null/memcmp.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/memcmp.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/memcmp.c 2014-05-29 13:57:53.098567650 -0600
|
|
|
383a11 |
@@ -0,0 +1,3 @@
|
|
|
383a11 |
+#define MEMCPY memcmp
|
|
|
383a11 |
+#define TYPE char
|
|
|
383a11 |
+#include "memcpy.c"
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/memcpy.c b/testsuite/memstomp.null/memcpy.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/memcpy.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/memcpy.c 2014-05-29 14:01:34.002999896 -0600
|
|
|
383a11 |
@@ -0,0 +1,20 @@
|
|
|
383a11 |
+#define _GNU_SOURCE
|
|
|
383a11 |
+#include <string.h>
|
|
|
383a11 |
+#include <wchar.h>
|
|
|
383a11 |
+
|
|
|
383a11 |
+#ifndef MEMCPY
|
|
|
383a11 |
+#define MEMCPY memcpy
|
|
|
383a11 |
+#define TYPE char
|
|
|
383a11 |
+#endif
|
|
|
383a11 |
+
|
|
|
383a11 |
+TYPE arr1[10] = {0};
|
|
|
383a11 |
+TYPE arr2[10] = {0};
|
|
|
383a11 |
+TYPE *p1 = &arr1[0];
|
|
|
383a11 |
+TYPE *p2 = &arr2[1];
|
|
|
383a11 |
+size_t count = 9;
|
|
|
383a11 |
+main ()
|
|
|
383a11 |
+{
|
|
|
383a11 |
+ return MEMCPY (NULL, NULL, 0) == 0 ;
|
|
|
383a11 |
+}
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/memmem.c b/testsuite/memstomp.null/memmem.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/memmem.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/memmem.c 2014-05-29 14:18:37.569363960 -0600
|
|
|
383a11 |
@@ -0,0 +1,20 @@
|
|
|
383a11 |
+#define _GNU_SOURCE
|
|
|
383a11 |
+#include <string.h>
|
|
|
383a11 |
+#include <wchar.h>
|
|
|
383a11 |
+
|
|
|
383a11 |
+#ifndef MEMMEM
|
|
|
383a11 |
+#define MEMMEM memmem
|
|
|
383a11 |
+#define TYPE char
|
|
|
383a11 |
+#endif
|
|
|
383a11 |
+
|
|
|
383a11 |
+TYPE arr1[10] = {0};
|
|
|
383a11 |
+TYPE arr2[10] = {0};
|
|
|
383a11 |
+TYPE *p1 = &arr1[0];
|
|
|
383a11 |
+TYPE *p2 = &arr2[1];
|
|
|
383a11 |
+size_t count = 9;
|
|
|
383a11 |
+main ()
|
|
|
383a11 |
+{
|
|
|
383a11 |
+ return MEMMEM (NULL, 0, NULL, 0) == 0 ;
|
|
|
383a11 |
+}
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/memmove.c b/testsuite/memstomp.null/memmove.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/memmove.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/memmove.c 2014-05-29 13:57:29.563628151 -0600
|
|
|
383a11 |
@@ -0,0 +1,3 @@
|
|
|
383a11 |
+#define MEMCPY memmove
|
|
|
383a11 |
+#define TYPE char
|
|
|
383a11 |
+#include "memcpy.c"
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/mempcpy.c b/testsuite/memstomp.null/mempcpy.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/mempcpy.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/mempcpy.c 2014-05-29 12:42:18.358166208 -0600
|
|
|
383a11 |
@@ -0,0 +1,3 @@
|
|
|
383a11 |
+#define MEMCPY mempcpy
|
|
|
383a11 |
+#define TYPE char
|
|
|
383a11 |
+#include "memcpy.c"
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/memrchr.c b/testsuite/memstomp.null/memrchr.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/memrchr.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/memrchr.c 2014-05-29 14:09:22.122797099 -0600
|
|
|
383a11 |
@@ -0,0 +1,4 @@
|
|
|
383a11 |
+#define MEMSET memrchr
|
|
|
383a11 |
+#define TYPE char
|
|
|
383a11 |
+#include "memset.c"
|
|
|
383a11 |
+
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/memset.c b/testsuite/memstomp.null/memset.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/memset.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/memset.c 2014-05-29 14:08:06.411991603 -0600
|
|
|
383a11 |
@@ -0,0 +1,20 @@
|
|
|
383a11 |
+#define _GNU_SOURCE
|
|
|
383a11 |
+#include <string.h>
|
|
|
383a11 |
+#include <wchar.h>
|
|
|
383a11 |
+
|
|
|
383a11 |
+#ifndef MEMSET
|
|
|
383a11 |
+#define MEMSET memset
|
|
|
383a11 |
+#define TYPE char
|
|
|
383a11 |
+#endif
|
|
|
383a11 |
+
|
|
|
383a11 |
+TYPE arr1[10] = {0};
|
|
|
383a11 |
+TYPE arr2[10] = {0};
|
|
|
383a11 |
+TYPE *p1 = &arr1[0];
|
|
|
383a11 |
+TYPE *p2 = &arr2[1];
|
|
|
383a11 |
+size_t count = 9;
|
|
|
383a11 |
+main ()
|
|
|
383a11 |
+{
|
|
|
383a11 |
+ return MEMSET (NULL, -1, 0) == 0;
|
|
|
383a11 |
+}
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/null.exp b/testsuite/memstomp.null/null.exp
|
|
|
383a11 |
--- a/testsuite/memstomp.null/null.exp 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/null.exp 2014-05-29 12:42:18.358166208 -0600
|
|
|
383a11 |
@@ -0,0 +1,59 @@
|
|
|
383a11 |
+# Copyright (C) 2013 Free Software Foundation, Inc.
|
|
|
383a11 |
+
|
|
|
383a11 |
+# This program is free software; you can redistribute it and/or modify
|
|
|
383a11 |
+# it under the terms of the GNU General Public License as published by
|
|
|
383a11 |
+# the Free Software Foundation; either version 3 of the License, or
|
|
|
383a11 |
+# (at your option) any later version.
|
|
|
383a11 |
+#
|
|
|
383a11 |
+# This program is distributed in the hope that it will be useful,
|
|
|
383a11 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
383a11 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
383a11 |
+# GNU General Public License for more details.
|
|
|
383a11 |
+#
|
|
|
383a11 |
+# You should have received a copy of the GNU General Public License
|
|
|
383a11 |
+# along with GCC; see the file COPYING3. If not see
|
|
|
383a11 |
+# <http://www.gnu.org/licenses/>.
|
|
|
383a11 |
+#
|
|
|
383a11 |
+# This was originally copied from GCC's dejagnu testing framework
|
|
|
383a11 |
+#
|
|
|
383a11 |
+
|
|
|
383a11 |
+load_lib memstomp.exp
|
|
|
383a11 |
+set memstomp [find_memstomp]
|
|
|
383a11 |
+set libmemstomp [find_libmemstomp]
|
|
|
383a11 |
+
|
|
|
383a11 |
+if $tracelevel then {
|
|
|
383a11 |
+ strace $tracelevel
|
|
|
383a11 |
+}
|
|
|
383a11 |
+
|
|
|
383a11 |
+#
|
|
|
383a11 |
+# main test loop
|
|
|
383a11 |
+#
|
|
|
383a11 |
+
|
|
|
383a11 |
+proc compile-and-execute { sources } {
|
|
|
383a11 |
+ global memstomp
|
|
|
383a11 |
+ global libmemstomp
|
|
|
383a11 |
+
|
|
|
383a11 |
+ set src [lindex $sources 0]
|
|
|
383a11 |
+
|
|
|
383a11 |
+ if {[catch {exec gcc -fno-builtin $src} results]} {
|
|
|
383a11 |
+ fail "$src compilation $results"
|
|
|
383a11 |
+ } else {
|
|
|
383a11 |
+ pass "$src compilation $results"
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ catch {exec /bin/bash -c "LD_PRELOAD=$libmemstomp $memstomp ./a.out"} results
|
|
|
383a11 |
+ if {[regexp "NULL pointer" $results]} {
|
|
|
383a11 |
+ pass "$src found NULL $results"
|
|
|
383a11 |
+ } else {
|
|
|
383a11 |
+ fail "$src found NULL $results"
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+}
|
|
|
383a11 |
+
|
|
|
383a11 |
+foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] {
|
|
|
383a11 |
+ # If we're only testing specific files and this isn't one of them, skip it.
|
|
|
383a11 |
+ if ![runtest_file_p $runtests $src] then {
|
|
|
383a11 |
+ continue
|
|
|
383a11 |
+ }
|
|
|
383a11 |
+
|
|
|
383a11 |
+ compile-and-execute $src
|
|
|
383a11 |
+}
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/rawmemchr.c b/testsuite/memstomp.null/rawmemchr.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/rawmemchr.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/rawmemchr.c 2014-05-29 14:10:36.610605748 -0600
|
|
|
383a11 |
@@ -0,0 +1,20 @@
|
|
|
383a11 |
+#define _GNU_SOURCE
|
|
|
383a11 |
+#include <string.h>
|
|
|
383a11 |
+#include <wchar.h>
|
|
|
383a11 |
+
|
|
|
383a11 |
+#ifndef RAWMEMCHR
|
|
|
383a11 |
+#define RAWMEMCHR rawmemchr
|
|
|
383a11 |
+#define TYPE char
|
|
|
383a11 |
+#endif
|
|
|
383a11 |
+
|
|
|
383a11 |
+TYPE arr1[10] = {0};
|
|
|
383a11 |
+TYPE arr2[10] = {0};
|
|
|
383a11 |
+TYPE *p1 = &arr1[0];
|
|
|
383a11 |
+TYPE *p2 = &arr2[1];
|
|
|
383a11 |
+size_t count = 9;
|
|
|
383a11 |
+main ()
|
|
|
383a11 |
+{
|
|
|
383a11 |
+ return RAWMEMCHR (NULL, 0) == 0;
|
|
|
383a11 |
+}
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/stpcpy.c b/testsuite/memstomp.null/stpcpy.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/stpcpy.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/stpcpy.c 2014-05-29 12:42:18.358166208 -0600
|
|
|
383a11 |
@@ -0,0 +1,2 @@
|
|
|
383a11 |
+#define STRCPY stpcpy
|
|
|
383a11 |
+#include "strcpy.c"
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/stpncpy.c b/testsuite/memstomp.null/stpncpy.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/stpncpy.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/stpncpy.c 2014-05-29 12:42:18.358166208 -0600
|
|
|
383a11 |
@@ -0,0 +1,2 @@
|
|
|
383a11 |
+#define STRNCPY stpncpy
|
|
|
383a11 |
+#include "strncpy.c"
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strcasestr.c b/testsuite/memstomp.null/strcasestr.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strcasestr.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strcasestr.c 2014-05-29 14:18:59.099308034 -0600
|
|
|
383a11 |
@@ -0,0 +1,2 @@
|
|
|
383a11 |
+#define STRCMP strstr
|
|
|
383a11 |
+#include "strcmp.c"
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strcat.c b/testsuite/memstomp.null/strcat.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strcat.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strcat.c 2014-05-29 12:42:18.359166205 -0600
|
|
|
383a11 |
@@ -0,0 +1,2 @@
|
|
|
383a11 |
+#define STRCPY strcat
|
|
|
383a11 |
+#include "strcpy.c"
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strchr.c b/testsuite/memstomp.null/strchr.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strchr.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strchr.c 2014-05-29 14:13:39.929134865 -0600
|
|
|
383a11 |
@@ -0,0 +1,4 @@
|
|
|
383a11 |
+#define RAWMEMCHR strchr
|
|
|
383a11 |
+#define TYPE char
|
|
|
383a11 |
+#include "rawmemchr.c"
|
|
|
383a11 |
+
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strchrnul.c b/testsuite/memstomp.null/strchrnul.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strchrnul.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strchrnul.c 2014-05-29 14:15:17.983882584 -0600
|
|
|
383a11 |
@@ -0,0 +1,4 @@
|
|
|
383a11 |
+#define RAWMEMCHR strrchr
|
|
|
383a11 |
+#define TYPE char
|
|
|
383a11 |
+#include "rawmemchr.c"
|
|
|
383a11 |
+
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strcmp.c b/testsuite/memstomp.null/strcmp.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strcmp.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strcmp.c 2014-05-29 14:17:21.903560538 -0600
|
|
|
383a11 |
@@ -0,0 +1,19 @@
|
|
|
383a11 |
+#define _GNU_SOURCE
|
|
|
383a11 |
+#include <string.h>
|
|
|
383a11 |
+#include <wchar.h>
|
|
|
383a11 |
+
|
|
|
383a11 |
+#ifndef STRCMP
|
|
|
383a11 |
+#define STRCMP strcmp
|
|
|
383a11 |
+#endif
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
+char arr1[32] = "this is a test";
|
|
|
383a11 |
+char arr2[32] = "this is a test";
|
|
|
383a11 |
+char *p1 = &arr1[0];
|
|
|
383a11 |
+char *p2 = &arr2[1];
|
|
|
383a11 |
+main ()
|
|
|
383a11 |
+{
|
|
|
383a11 |
+ return STRCMP (NULL, NULL) == 0;
|
|
|
383a11 |
+}
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strcoll.c b/testsuite/memstomp.null/strcoll.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strcoll.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strcoll.c 2014-05-29 14:04:39.735522619 -0600
|
|
|
383a11 |
@@ -0,0 +1,2 @@
|
|
|
383a11 |
+#define STRNCPY strcoll
|
|
|
383a11 |
+#include "strcmp.c"
|
|
|
383a11 |
Binary files a/testsuite/memstomp.null/.strcoll.c.swp and b/testsuite/memstomp.null/.strcoll.c.swp differ
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strcoll_l.c b/testsuite/memstomp.null/strcoll_l.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strcoll_l.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strcoll_l.c 2014-05-29 14:05:22.181413555 -0600
|
|
|
383a11 |
@@ -0,0 +1,19 @@
|
|
|
383a11 |
+#define _GNU_SOURCE
|
|
|
383a11 |
+#include <string.h>
|
|
|
383a11 |
+#include <wchar.h>
|
|
|
383a11 |
+
|
|
|
383a11 |
+#ifndef STRCMP
|
|
|
383a11 |
+#define STRCMP strcoll_l
|
|
|
383a11 |
+#endif
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
+char arr1[32] = "this is a test";
|
|
|
383a11 |
+char arr2[32] = "this is a test";
|
|
|
383a11 |
+char *p1 = &arr1[0];
|
|
|
383a11 |
+char *p2 = &arr2[1];
|
|
|
383a11 |
+main ()
|
|
|
383a11 |
+{
|
|
|
383a11 |
+ return STRCMP (NULL, NULL, NULL);
|
|
|
383a11 |
+}
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strcpy.c b/testsuite/memstomp.null/strcpy.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strcpy.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strcpy.c 2014-05-29 12:42:18.359166205 -0600
|
|
|
383a11 |
@@ -0,0 +1,19 @@
|
|
|
383a11 |
+#define _GNU_SOURCE
|
|
|
383a11 |
+#include <string.h>
|
|
|
383a11 |
+#include <wchar.h>
|
|
|
383a11 |
+
|
|
|
383a11 |
+#ifndef STRCPY
|
|
|
383a11 |
+#define STRCPY strcpy
|
|
|
383a11 |
+#endif
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
+char arr1[32] = "this is a test";
|
|
|
383a11 |
+char arr2[32] = "this is a test";
|
|
|
383a11 |
+char *p1 = &arr1[0];
|
|
|
383a11 |
+char *p2 = &arr2[1];
|
|
|
383a11 |
+main ()
|
|
|
383a11 |
+{
|
|
|
383a11 |
+ STRCPY (NULL, NULL);
|
|
|
383a11 |
+}
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strcspn.c b/testsuite/memstomp.null/strcspn.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strcspn.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strcspn.c 2014-05-29 14:16:12.219741618 -0600
|
|
|
383a11 |
@@ -0,0 +1,2 @@
|
|
|
383a11 |
+#define STRCMP strcspn
|
|
|
383a11 |
+#include "strcmp.c"
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strdup.c b/testsuite/memstomp.null/strdup.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strdup.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strdup.c 2014-05-29 14:12:20.521338829 -0600
|
|
|
383a11 |
@@ -0,0 +1,3 @@
|
|
|
383a11 |
+#define STRLEN strdup
|
|
|
383a11 |
+#define TYPE char
|
|
|
383a11 |
+#include "strlen.c"
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strlen.c b/testsuite/memstomp.null/strlen.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strlen.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strlen.c 2014-05-29 14:12:28.969317129 -0600
|
|
|
383a11 |
@@ -0,0 +1,19 @@
|
|
|
383a11 |
+#define _GNU_SOURCE
|
|
|
383a11 |
+#include <string.h>
|
|
|
383a11 |
+#include <wchar.h>
|
|
|
383a11 |
+
|
|
|
383a11 |
+#ifndef STRLEN
|
|
|
383a11 |
+#define STRLEN strlen
|
|
|
383a11 |
+#endif
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
+char arr1[32] = "this is a test";
|
|
|
383a11 |
+char arr2[32] = "this is a test";
|
|
|
383a11 |
+char *p1 = &arr1[0];
|
|
|
383a11 |
+char *p2 = &arr2[1];
|
|
|
383a11 |
+main ()
|
|
|
383a11 |
+{
|
|
|
383a11 |
+ return STRLEN (NULL) == 0;
|
|
|
383a11 |
+}
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strncat.c b/testsuite/memstomp.null/strncat.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strncat.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strncat.c 2014-05-29 12:42:18.359166205 -0600
|
|
|
383a11 |
@@ -0,0 +1,2 @@
|
|
|
383a11 |
+#define STRNCPY strncat
|
|
|
383a11 |
+#include "strncpy.c"
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strncmp.c b/testsuite/memstomp.null/strncmp.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strncmp.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strncmp.c 2014-05-29 14:03:31.222698668 -0600
|
|
|
383a11 |
@@ -0,0 +1,19 @@
|
|
|
383a11 |
+#define _GNU_SOURCE
|
|
|
383a11 |
+#include <string.h>
|
|
|
383a11 |
+#include <wchar.h>
|
|
|
383a11 |
+
|
|
|
383a11 |
+#ifndef STRNCMP
|
|
|
383a11 |
+#define STRNCMP strncmp
|
|
|
383a11 |
+#endif
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
+char arr1[32] = "this is a test";
|
|
|
383a11 |
+char arr2[32] = "this is a test";
|
|
|
383a11 |
+char *p1 = &arr1[0];
|
|
|
383a11 |
+char *p2 = &arr2[1];
|
|
|
383a11 |
+main ()
|
|
|
383a11 |
+{
|
|
|
383a11 |
+ return STRNCMP (NULL, NULL, 0);
|
|
|
383a11 |
+}
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strncpy.c b/testsuite/memstomp.null/strncpy.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strncpy.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strncpy.c 2014-05-29 12:42:18.359166205 -0600
|
|
|
383a11 |
@@ -0,0 +1,19 @@
|
|
|
383a11 |
+#define _GNU_SOURCE
|
|
|
383a11 |
+#include <string.h>
|
|
|
383a11 |
+#include <wchar.h>
|
|
|
383a11 |
+
|
|
|
383a11 |
+#ifndef STRNCPY
|
|
|
383a11 |
+#define STRNCPY strncpy
|
|
|
383a11 |
+#endif
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
+char arr1[32] = "this is a test";
|
|
|
383a11 |
+char arr2[32] = "this is a test";
|
|
|
383a11 |
+char *p1 = &arr1[0];
|
|
|
383a11 |
+char *p2 = &arr2[1];
|
|
|
383a11 |
+main ()
|
|
|
383a11 |
+{
|
|
|
383a11 |
+ STRNCPY (NULL, NULL, 0);
|
|
|
383a11 |
+}
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strndup.c b/testsuite/memstomp.null/strndup.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strndup.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strndup.c 2014-05-29 14:13:18.192190697 -0600
|
|
|
383a11 |
@@ -0,0 +1,4 @@
|
|
|
383a11 |
+#define RAWMEMCHR strndup
|
|
|
383a11 |
+#define TYPE char
|
|
|
383a11 |
+#include "rawmemchr.c"
|
|
|
383a11 |
+
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strpbrk.c b/testsuite/memstomp.null/strpbrk.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strpbrk.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strpbrk.c 2014-05-29 14:17:09.970591544 -0600
|
|
|
383a11 |
@@ -0,0 +1,2 @@
|
|
|
383a11 |
+#define STRCMP strpbrk
|
|
|
383a11 |
+#include "strcmp.c"
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strrchr.c b/testsuite/memstomp.null/strrchr.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strrchr.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strrchr.c 2014-05-29 14:15:23.466868332 -0600
|
|
|
383a11 |
@@ -0,0 +1,4 @@
|
|
|
383a11 |
+#define RAWMEMCHR strchrnul
|
|
|
383a11 |
+#define TYPE char
|
|
|
383a11 |
+#include "rawmemchr.c"
|
|
|
383a11 |
+
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strspn.c b/testsuite/memstomp.null/strspn.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strspn.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strspn.c 2014-05-29 14:16:33.880685326 -0600
|
|
|
383a11 |
@@ -0,0 +1,2 @@
|
|
|
383a11 |
+#define STRCMP strspn
|
|
|
383a11 |
+#include "strcmp.c"
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strstr.c b/testsuite/memstomp.null/strstr.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strstr.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strstr.c 2014-05-29 14:16:56.195627338 -0600
|
|
|
383a11 |
@@ -0,0 +1,2 @@
|
|
|
383a11 |
+#define STRCMP strstr
|
|
|
383a11 |
+#include "strcmp.c"
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strtok.c b/testsuite/memstomp.null/strtok.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strtok.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strtok.c 2014-05-29 14:19:10.868277465 -0600
|
|
|
383a11 |
@@ -0,0 +1,2 @@
|
|
|
383a11 |
+#define STRCMP strtok
|
|
|
383a11 |
+#include "strcmp.c"
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strtok_r.c b/testsuite/memstomp.null/strtok_r.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strtok_r.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strtok_r.c 2014-05-29 14:19:53.089167807 -0600
|
|
|
383a11 |
@@ -0,0 +1,20 @@
|
|
|
383a11 |
+#define _GNU_SOURCE
|
|
|
383a11 |
+#include <string.h>
|
|
|
383a11 |
+#include <wchar.h>
|
|
|
383a11 |
+
|
|
|
383a11 |
+#ifndef STRTOK_R
|
|
|
383a11 |
+#define STRTOK_R strtok_r
|
|
|
383a11 |
+#define TYPE char
|
|
|
383a11 |
+#endif
|
|
|
383a11 |
+
|
|
|
383a11 |
+TYPE arr1[10] = {0};
|
|
|
383a11 |
+TYPE arr2[10] = {0};
|
|
|
383a11 |
+TYPE *p1 = &arr1[0];
|
|
|
383a11 |
+TYPE *p2 = &arr2[1];
|
|
|
383a11 |
+size_t count = 9;
|
|
|
383a11 |
+main ()
|
|
|
383a11 |
+{
|
|
|
383a11 |
+ return STRTOK_R (NULL, NULL, NULL) == 0 ;
|
|
|
383a11 |
+}
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strxfrm.c b/testsuite/memstomp.null/strxfrm.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strxfrm.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strxfrm.c 2014-05-29 14:06:23.335256429 -0600
|
|
|
383a11 |
@@ -0,0 +1,2 @@
|
|
|
383a11 |
+#define STRNCPY strxfrm
|
|
|
383a11 |
+#include "strcmp.c"
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/strxfrm_l.c b/testsuite/memstomp.null/strxfrm_l.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/strxfrm_l.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/strxfrm_l.c 2014-05-29 14:07:10.004136524 -0600
|
|
|
383a11 |
@@ -0,0 +1,19 @@
|
|
|
383a11 |
+#define _GNU_SOURCE
|
|
|
383a11 |
+#include <string.h>
|
|
|
383a11 |
+#include <wchar.h>
|
|
|
383a11 |
+
|
|
|
383a11 |
+#ifndef STRCMP
|
|
|
383a11 |
+#define STRCMP strxfrm_l
|
|
|
383a11 |
+#endif
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
+char arr1[32] = "this is a test";
|
|
|
383a11 |
+char arr2[32] = "this is a test";
|
|
|
383a11 |
+char *p1 = &arr1[0];
|
|
|
383a11 |
+char *p2 = &arr2[1];
|
|
|
383a11 |
+main ()
|
|
|
383a11 |
+{
|
|
|
383a11 |
+ return STRCMP (NULL, NULL, 0, NULL);
|
|
|
383a11 |
+}
|
|
|
383a11 |
+
|
|
|
383a11 |
+
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/wmemcpy.c b/testsuite/memstomp.null/wmemcpy.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/wmemcpy.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/wmemcpy.c 2014-05-29 12:42:18.359166205 -0600
|
|
|
383a11 |
@@ -0,0 +1,3 @@
|
|
|
383a11 |
+#define MEMCPY wmemcpy
|
|
|
383a11 |
+#define TYPE wchar_t
|
|
|
383a11 |
+#include "memcpy.c"
|
|
|
383a11 |
diff -Nrup a/testsuite/memstomp.null/wmempcpy.c b/testsuite/memstomp.null/wmempcpy.c
|
|
|
383a11 |
--- a/testsuite/memstomp.null/wmempcpy.c 1969-12-31 17:00:00.000000000 -0700
|
|
|
383a11 |
+++ b/testsuite/memstomp.null/wmempcpy.c 2014-05-29 12:42:18.359166205 -0600
|
|
|
383a11 |
@@ -0,0 +1,3 @@
|
|
|
383a11 |
+#define MEMCPY wmempcpy
|
|
|
383a11 |
+#define TYPE wchar_t
|
|
|
383a11 |
+#include "memcpy.c"
|