diff options
| author | Jakob Kaivo <jkk@ung.org> | 2024-01-31 13:24:56 -0500 |
|---|---|---|
| committer | Jakob Kaivo <jkk@ung.org> | 2024-01-31 13:24:56 -0500 |
| commit | 4b43b375b7abae22070cd86bfc26a8222233150e (patch) | |
| tree | 6ff165b17879e80300cb6d05b5537a65c82c2dc7 /src/wchar | |
| parent | ab3c589cd14c2b7efd79c89fd75ea35edcf9edff (diff) | |
check for overlapping pointers
Diffstat (limited to 'src/wchar')
41 files changed, 42 insertions, 0 deletions
diff --git a/src/wchar/fgetws.c b/src/wchar/fgetws.c index 5a1b71aa..1e341c18 100644 --- a/src/wchar/fgetws.c +++ b/src/wchar/fgetws.c @@ -10,6 +10,7 @@ wchar_t * fgetws(wchar_t * restrict s, int n, FILE * restrict stream) ASSERT_NONNULL(s); ASSERT_NONNULL(stream); + /* TODO: overlap */ if (fwide(stream, 1) <= 0) { /* not a wide stream */ diff --git a/src/wchar/fputws.c b/src/wchar/fputws.c index b06f73a1..4da7b13c 100644 --- a/src/wchar/fputws.c +++ b/src/wchar/fputws.c @@ -6,6 +6,7 @@ int fputws(const wchar_t * restrict s, FILE * restrict stream) { SIGNAL_SAFE(0); + /* TODO: overlap */ const wchar_t *p = s; while (*p != L'\0') { diff --git a/src/wchar/fwprintf.c b/src/wchar/fwprintf.c index f3ee6f9c..659bd3fd 100644 --- a/src/wchar/fwprintf.c +++ b/src/wchar/fwprintf.c @@ -7,6 +7,7 @@ int fwprintf(FILE * restrict stream, const wchar_t * restrict format, ...) { SIGNAL_SAFE(0); + /* TODO: overlap */ va_list ap; va_start(ap, format); diff --git a/src/wchar/fwscanf.c b/src/wchar/fwscanf.c index 46cd0b23..b691ef53 100644 --- a/src/wchar/fwscanf.c +++ b/src/wchar/fwscanf.c @@ -12,6 +12,7 @@ int fwscanf(FILE * restrict stream, const wchar_t * restrict format, ...) { SIGNAL_SAFE(0); + /* TODO: overlap */ va_list ap; va_start(ap, format); diff --git a/src/wchar/mbrlen.c b/src/wchar/mbrlen.c index 4489ad83..135a56b2 100644 --- a/src/wchar/mbrlen.c +++ b/src/wchar/mbrlen.c @@ -4,7 +4,9 @@ size_t mbrlen(const char * restrict s, size_t n, mbstate_t * restrict ps) { + SIGNAL_SAFE(0); + /* TODO: overlap */ static mbstate_t internal = 0; return mbrtowc(NULL, s, n, ps != NULL ? ps : &internal); diff --git a/src/wchar/mbrtowc.c b/src/wchar/mbrtowc.c index 56a50a11..16e2a937 100644 --- a/src/wchar/mbrtowc.c +++ b/src/wchar/mbrtowc.c @@ -5,6 +5,7 @@ size_t mbrtowc(wchar_t * restrict pwc, const char * restrict s, size_t n, mbstate_t * restrict ps) { SIGNAL_SAFE(0); + /* TODO: overlap */ (void)ps; (void)pwc; (void)n; diff --git a/src/wchar/mbsrtowcs.c b/src/wchar/mbsrtowcs.c index 2a97cc83..2f273598 100644 --- a/src/wchar/mbsrtowcs.c +++ b/src/wchar/mbsrtowcs.c @@ -5,6 +5,7 @@ size_t mbsrtowcs(wchar_t * restrict dst, const char * restrict src, size_t len, mbstate_t * restrict ps) { SIGNAL_SAFE(0); + /* TODO: overlap */ (void)dst; (void)src; (void)len; (void)ps; return 0; diff --git a/src/wchar/swprintf.c b/src/wchar/swprintf.c index 6cc546c3..30c3baf7 100644 --- a/src/wchar/swprintf.c +++ b/src/wchar/swprintf.c @@ -6,6 +6,7 @@ int swprintf(wchar_t * restrict s, size_t n, const wchar_t * restrict format, ...) { SIGNAL_SAFE(0); + /* TODO: overlap */ va_list ap; va_start(ap, format); diff --git a/src/wchar/swscanf.c b/src/wchar/swscanf.c index 3897662c..81726bff 100644 --- a/src/wchar/swscanf.c +++ b/src/wchar/swscanf.c @@ -11,6 +11,7 @@ int swscanf(const wchar_t * restrict s, const wchar_t * restrict format, ...) { SIGNAL_SAFE(0); + /* TODO: overlap */ va_list ap; va_start(ap, format); diff --git a/src/wchar/vfwprintf.c b/src/wchar/vfwprintf.c index 89e4c6b5..9374d2be 100644 --- a/src/wchar/vfwprintf.c +++ b/src/wchar/vfwprintf.c @@ -9,6 +9,7 @@ int vfwprintf(FILE * restrict stream, const wchar_t * restrict format, va_list arg) { SIGNAL_SAFE(0); + /* TODO: overlap */ int ret = 0; struct io_options opt = {0}; diff --git a/src/wchar/vfwscanf.c b/src/wchar/vfwscanf.c index e727b0c8..617ee56d 100644 --- a/src/wchar/vfwscanf.c +++ b/src/wchar/vfwscanf.c @@ -11,6 +11,7 @@ int vfwscanf(FILE * restrict stream, const wchar_t * restrict format, va_list arg) { SIGNAL_SAFE(0); + /* TODO: overlap */ int ret = 0; struct io_options opt = {0}; diff --git a/src/wchar/vswprintf.c b/src/wchar/vswprintf.c index e9229399..022bf4c5 100644 --- a/src/wchar/vswprintf.c +++ b/src/wchar/vswprintf.c @@ -7,6 +7,7 @@ int vswprintf(wchar_t * restrict s, size_t n, const wchar_t * restrict format, va_list arg) { SIGNAL_SAFE(0); + /* TODO: overlap */ int ret = 0; struct io_options opt = {0}; diff --git a/src/wchar/vswscanf.c b/src/wchar/vswscanf.c index c28bd64f..bd49ee3e 100644 --- a/src/wchar/vswscanf.c +++ b/src/wchar/vswscanf.c @@ -10,6 +10,7 @@ int vswscanf(const wchar_t * restrict s, const wchar_t * restrict format, va_list arg) { SIGNAL_SAFE(0); + /* TODO: overlap */ int ret = 0; struct io_options opt = {0}; diff --git a/src/wchar/wcrtomb.c b/src/wchar/wcrtomb.c index beff6457..1c48df7f 100644 --- a/src/wchar/wcrtomb.c +++ b/src/wchar/wcrtomb.c @@ -6,6 +6,7 @@ size_t wcrtomb(char * restrict s, wchar_t wc, mbstate_t * restrict ps) { SIGNAL_SAFE(0); + /* TODO: overlap */ char buf[MB_LEN_MAX+1]; if (s == NULL) { diff --git a/src/wchar/wcscat.c b/src/wchar/wcscat.c index 2674e218..798c5940 100644 --- a/src/wchar/wcscat.c +++ b/src/wchar/wcscat.c @@ -5,6 +5,7 @@ wchar_t * wcscat(wchar_t * restrict s1, const wchar_t * restrict s2) { SIGNAL_SAFE(0); + /* TODO: overlap */ wcscpy(s1 + wcslen(s1), s2); return s1; diff --git a/src/wchar/wcschr.c b/src/wchar/wcschr.c index 7fdecb89..9b050769 100644 --- a/src/wchar/wcschr.c +++ b/src/wchar/wcschr.c @@ -5,6 +5,7 @@ wchar_t * wcschr(const wchar_t * s, wchar_t c) { SIGNAL_SAFE(0); + /* TODO: overlap */ while (*s) { if (*s == c) { diff --git a/src/wchar/wcscmp.c b/src/wchar/wcscmp.c index 6693cc63..2c106f43 100644 --- a/src/wchar/wcscmp.c +++ b/src/wchar/wcscmp.c @@ -9,6 +9,7 @@ int wcscmp(const wchar_t * s1, const wchar_t * s2) ASSERT_NONNULL(s1); ASSERT_NONNULL(s2); + /* TODO: overlap */ while (*s1 == *s2 && *s1 != L'\0') { s1++; diff --git a/src/wchar/wcscoll.c b/src/wchar/wcscoll.c index 4386b525..a057b946 100644 --- a/src/wchar/wcscoll.c +++ b/src/wchar/wcscoll.c @@ -5,6 +5,7 @@ int wcscoll(const wchar_t * s1, const wchar_t * s2) { SIGNAL_SAFE(0); + /* TODO: overlap */ /* wchar_t *collated_s1 = s1; diff --git a/src/wchar/wcscpy.c b/src/wchar/wcscpy.c index ce366198..af643326 100644 --- a/src/wchar/wcscpy.c +++ b/src/wchar/wcscpy.c @@ -5,6 +5,7 @@ wchar_t * wcscpy(wchar_t * restrict s1, const wchar_t * restrict s2) { SIGNAL_SAFE(0); + /* TODO: overlap */ return wcsncpy(s1, s2, wcslen(s2)); } diff --git a/src/wchar/wcscspn.c b/src/wchar/wcscspn.c index 5b5db5f3..178d67bf 100644 --- a/src/wchar/wcscspn.c +++ b/src/wchar/wcscspn.c @@ -11,6 +11,7 @@ size_t wcscspn(const wchar_t * s1, const wchar_t * s2) ASSERT_NONNULL(s1); ASSERT_NONNULL(s2); + /* TODO: overlap */ for (i = 0; s1[i] != L'\0'; i++) { if (s1[i] == L'\0' || wcschr(s2, s1[i]) == NULL) { diff --git a/src/wchar/wcsftime.c b/src/wchar/wcsftime.c index e04eb966..814bc95f 100644 --- a/src/wchar/wcsftime.c +++ b/src/wchar/wcsftime.c @@ -5,6 +5,7 @@ size_t wcsftime(wchar_t * restrict s, size_t maxsize, const wchar_t * restrict format, const struct tm * restrict timeptr) { SIGNAL_SAFE(0); + /* TODO: overlap */ (void)s; (void)maxsize; (void)format; (void)timeptr; return 0; diff --git a/src/wchar/wcsncat.c b/src/wchar/wcsncat.c index 8cda3694..121fc99f 100644 --- a/src/wchar/wcsncat.c +++ b/src/wchar/wcsncat.c @@ -5,6 +5,7 @@ wchar_t * wcsncat(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n) { SIGNAL_SAFE(0); + /* TODO: overlap */ wcsncpy(s1 + wcslen(s1), s2, n); /* ensure trailing nul */ diff --git a/src/wchar/wcsncmp.c b/src/wchar/wcsncmp.c index 0caa5a9e..cf4c68a8 100644 --- a/src/wchar/wcsncmp.c +++ b/src/wchar/wcsncmp.c @@ -11,6 +11,7 @@ int wcsncmp(const wchar_t * s1, const wchar_t * s2, size_t n) ASSERT_NONNULL(s1); ASSERT_NONNULL(s2); + /* TODO: overlap */ for (i = 0; i < n; i++) { if (s1[i] > s2[i]) { diff --git a/src/wchar/wcsncpy.c b/src/wchar/wcsncpy.c index 2c595575..40537890 100644 --- a/src/wchar/wcsncpy.c +++ b/src/wchar/wcsncpy.c @@ -5,6 +5,7 @@ wchar_t * wcsncpy(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n) { SIGNAL_SAFE(0); + /* TODO: overlap */ size_t i; int nul = 0; diff --git a/src/wchar/wcspbrk.c b/src/wchar/wcspbrk.c index fb72904c..20c25222 100644 --- a/src/wchar/wcspbrk.c +++ b/src/wchar/wcspbrk.c @@ -5,6 +5,7 @@ wchar_t * wcspbrk(const wchar_t * s1, const wchar_t * s2) { SIGNAL_SAFE(0); + /* TODO: overlap */ int i; for (i = 0; s1[i] != L'\0'; i++) { diff --git a/src/wchar/wcsrtombs.c b/src/wchar/wcsrtombs.c index 82a38ff9..9a3c6c87 100644 --- a/src/wchar/wcsrtombs.c +++ b/src/wchar/wcsrtombs.c @@ -5,6 +5,7 @@ size_t wcsrtombs(char * restrict dst, const wchar_t ** restrict src, size_t len, mbstate_t * restrict ps) { SIGNAL_SAFE(0); + /* TODO: overlap */ (void)dst; (void)src; (void)len; (void)ps; return 0; diff --git a/src/wchar/wcsspn.c b/src/wchar/wcsspn.c index ebf30980..5d1ae0df 100644 --- a/src/wchar/wcsspn.c +++ b/src/wchar/wcsspn.c @@ -5,6 +5,7 @@ size_t wcsspn(const wchar_t * s1, const wchar_t * s2) { SIGNAL_SAFE(0); + /* TODO: overlap */ size_t i; for (i = 0; s1[i] != L'\0'; i++) { diff --git a/src/wchar/wcstod.c b/src/wchar/wcstod.c index b5be3bcf..9f5b1c52 100644 --- a/src/wchar/wcstod.c +++ b/src/wchar/wcstod.c @@ -5,6 +5,7 @@ double wcstod(const wchar_t * restrict nptr, wchar_t ** restrict endptr) { SIGNAL_SAFE(0); + /* TODO: overlap */ (void)nptr; (void)endptr; return 0.0; diff --git a/src/wchar/wcstof.c b/src/wchar/wcstof.c index abea9395..c7845909 100644 --- a/src/wchar/wcstof.c +++ b/src/wchar/wcstof.c @@ -5,6 +5,7 @@ float wcstof(const wchar_t * restrict nptr, wchar_t ** restrict endptr) { SIGNAL_SAFE(0); + /* TODO: overlap */ (void)nptr; (void)endptr; return 0; diff --git a/src/wchar/wcstok.c b/src/wchar/wcstok.c index 484053d2..a9cf8d01 100644 --- a/src/wchar/wcstok.c +++ b/src/wchar/wcstok.c @@ -5,6 +5,7 @@ wchar_t * wcstok(wchar_t * restrict s1, const wchar_t * restrict s2, wchar_t ** restrict ptr) { SIGNAL_SAFE(0); + /* TODO: overlap */ (void)s1; (void)s2; (void)ptr; return s1; diff --git a/src/wchar/wcstol.c b/src/wchar/wcstol.c index 414429ac..54cbf696 100644 --- a/src/wchar/wcstol.c +++ b/src/wchar/wcstol.c @@ -10,6 +10,7 @@ long int wcstol(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base) { SIGNAL_SAFE(0); + /* TODO: overlap */ long int ret = 0; long int max = LONG_MAX; diff --git a/src/wchar/wcstold.c b/src/wchar/wcstold.c index bf0304b6..a4847d40 100644 --- a/src/wchar/wcstold.c +++ b/src/wchar/wcstold.c @@ -5,6 +5,7 @@ long double wcstold(const wchar_t * restrict nptr, wchar_t ** restrict endptr) { SIGNAL_SAFE(0); + /* TODO: overlap */ (void)nptr; (void)endptr; return 0; diff --git a/src/wchar/wcstoll.c b/src/wchar/wcstoll.c index 5a86a745..1438da14 100644 --- a/src/wchar/wcstoll.c +++ b/src/wchar/wcstoll.c @@ -10,6 +10,7 @@ long long int wcstoll(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base) { SIGNAL_SAFE(0); + /* TODO: overlap */ long long int ret = 0; long long int max = LLONG_MAX; diff --git a/src/wchar/wcstoul.c b/src/wchar/wcstoul.c index e7be6154..bf5771d9 100644 --- a/src/wchar/wcstoul.c +++ b/src/wchar/wcstoul.c @@ -10,6 +10,7 @@ unsigned long int wcstoul(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base) { SIGNAL_SAFE(0); + /* TODO: overlap */ unsigned long int ret = 0; unsigned long int max = ULONG_MAX; diff --git a/src/wchar/wcstoull.c b/src/wchar/wcstoull.c index 26d61460..c8828d46 100644 --- a/src/wchar/wcstoull.c +++ b/src/wchar/wcstoull.c @@ -10,6 +10,7 @@ unsigned long long int wcstoull(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base) { SIGNAL_SAFE(0); + /* TODO: overlap */ unsigned long long int ret = 0; unsigned long long int max = ULLONG_MAX; diff --git a/src/wchar/wcswcs.c b/src/wchar/wcswcs.c index c4541af9..07aff7d4 100644 --- a/src/wchar/wcswcs.c +++ b/src/wchar/wcswcs.c @@ -13,6 +13,7 @@ wchar_t * wcswcs(const wchar_t * s1, const wchar_t * s2) { SIGNAL_SAFE(0); + /* TODO: overlap */ return wcsstr(s1, s2); } diff --git a/src/wchar/wcsxfrm.c b/src/wchar/wcsxfrm.c index c025ee7e..ada9ff7a 100644 --- a/src/wchar/wcsxfrm.c +++ b/src/wchar/wcsxfrm.c @@ -5,6 +5,7 @@ size_t wcsxfrm(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n) { SIGNAL_SAFE(0); + /* TODO: overlap */ (void)s1; (void)s2; (void)n; return 0; diff --git a/src/wchar/wmemchr.c b/src/wchar/wmemchr.c index f6ab1f25..471b67f8 100644 --- a/src/wchar/wmemchr.c +++ b/src/wchar/wmemchr.c @@ -6,6 +6,7 @@ wchar_t * wmemchr(const wchar_t * s, wchar_t c, size_t n) { SIGNAL_SAFE(0); + /* TODO: overlap */ size_t i; diff --git a/src/wchar/wmemcmp.c b/src/wchar/wmemcmp.c index 693211d1..b607620f 100644 --- a/src/wchar/wmemcmp.c +++ b/src/wchar/wmemcmp.c @@ -5,6 +5,7 @@ int wmemcmp(const wchar_t * s1, const wchar_t * s2, size_t n) { SIGNAL_SAFE(0); + /* TODO: overlap */ size_t i; diff --git a/src/wchar/wmemcpy.c b/src/wchar/wmemcpy.c index b45912a2..5e4ee6d7 100644 --- a/src/wchar/wmemcpy.c +++ b/src/wchar/wmemcpy.c @@ -5,6 +5,7 @@ wchar_t * wmemcpy(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n) { SIGNAL_SAFE(0); + /* TODO: overlap */ size_t i; for (i = 0; i < n; i++) { diff --git a/src/wchar/wmemset.c b/src/wchar/wmemset.c index 6bf8e38b..dd9d1fc7 100644 --- a/src/wchar/wmemset.c +++ b/src/wchar/wmemset.c @@ -5,6 +5,7 @@ wchar_t * wmemset(wchar_t * s, wchar_t c, size_t n) { SIGNAL_SAFE(0); + /* TODO: overlap */ size_t i; for (i = 0; i < n; i++) { |
