summaryrefslogtreecommitdiff
path: root/tests/Makefile (follow)
AgeCommit message (Collapse)Author
34 hoursFix strncat/wcsncatjvoisin
Previously, no checks were done when __n <= __b, but strncat _appends_ after existing content, making this a overly broad check check. For example, with an 8-byte buffer containing "12345\0", strncat(buf, "ABCD", 4) would have the check skipped, but the result "12345ABCD\0" is 10 bytes, resulting in an overflow. This commit fixes this oversight, and adds a bunch of tests.
41 hoursFix mbsnrtowcsjvoisin
mbsnrtowcs writes up to __wn wide characters into wchar_t *__d. The destination capacity is __b / sizeof(wchar_t) wide characters, but the else branch clamps __n (source byte limit) to __b (destination byte size). __wn (the actual output count) is passed through unclamped. Example: __b=8 (dest holds 2 wchar_t), __n=100, __wn=25. The else branch applies (25 <= 100/4), clamps source to 8 bytes, but passes __wn=25 β€” the function can write 25 wchar_t (100 bytes) into an 8-byte buffer. The first branch is also wrong: it divides __b (bytes) by sizeof(wchar_t) to get wchar_t capacity, which is correct for the destination β€” but the condition __wn > __n / sizeof(wchar_t) uses integer division that can produce incorrect routing between branches. The fix mirrors the already-correct mbsrtowcs pattern: clamp __wn (the output wide-char count) to the destination's wchar_t capacity, and pass __n (source byte limit) through unchanged.
41 hoursFix a POSIX violation for swabjvoisin
41 hoursImprove coverage for wmemcpy and wmemmovejvoisin
Like it's already done for memcpy and memmove. Add tests as well, to prove that nothing broke.
41 hoursFix a bug in wcsnrtombsjvoisin
__d is a char * destination buffer, so __b is already the byte capacity. Dividing by sizeof(wchar_t) makes no sense here, it was likely copy-pasted from mbsnrtowcs (where the destination is wchar_t *). The first branch also fails to limit __n (the byte write cap) to __b, so overflows are possible when a wide character produces multi-byte output. The second branch (else) correctly limits __n to __b. This commit replaces the broken two-branch logic with the simple correct pattern matching wcsrtombs, and adds two tests two prove that nothing broke.
10 daysAdd a regression test for wcrtombjvoisin
This was fixed in a255506ca487250255f9f048e61cf90166ceab77
2026-04-13Use shared COMMON_FLAGS in testsSertonix
Fixes CXXFLAGS missing -I../include/ and avoids similar issues to happen in the future
2026-04-01Make do even if PATH_MAX isn't definedjvoisin
As explained in `man realpath(3)`: > The POSIX.1-2001 standard version of this function is broken by design, > since it is impossible to determine a suitable size for the output > buffer, resolved_path. According to POSIX.1-2001 a buffer of size PATH_MAX > suffices, but PATH_MAX need not be a defined constant, and may have to be > obtained using pathconf(3). And asking pathconf(3) does not really help, > since, on the one hand POSIX warns that the result of pathconf(3) may be huge > and unsuitable for mallocing memory, and on the other hand pathconf(3) may > return -1 to signify that PATH_MAX is not bounded. The re‐ solved_path > == NULL feature, not standardized in POSIX.1-2001, but standardized in > POSIX.1-2008, allows this design problem to be avoided. So we can either not compile, or be pragmatic, and define PATH_MAX to a sane value, like 4096, which is the one used on Linux and some/most BSD. This commit also adds two tests to ensure that things aren't catastrophically broken by this change.
2026-03-13Add some compilers flags to the C++ testsuitejvoisin
Notably -Wno-fortify-source, to prevent clang from using its own fortify implementation. Co-Authored-By: Sertonix
2026-03-13Fixes compilation with clang and -D_FORTIFY_SOURCE=2jvoisin
This commit fixes the typo pass_object_size__ for pass_object_size. It also adds tests in the CI to prevent this from happening again. Ref https://clang.llvm.org/docs/AttributeReference.html#pass-object-size-pass-dynamic-object-size Co-Authored-By: Sertonix
2025-11-11Add a testsuitejvoisin
Co-Authored-By: q66 <q66@chimera-linux.org>