aboutsummaryrefslogtreecommitdiff
path: root/secure/lib/libdes/testdes.pl
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2026-09-03 05:23:53 +0000
committerXin LI <delphij@FreeBSD.org>2026-09-03 06:51:36 +0000
commitc4f458da4411872df4968e02ca292389df462b7b (patch)
tree15a224a5974fcc83b9aa9e51df57492cf2371ae1 /secure/lib/libdes/testdes.pl
parent18094609d301540526d3d57e92705bc989d29986 (diff)
fsck_msdosfs: add tests for the 32-bit boot block field decodingHEADmain
Exercise each of the 32-bit BIOS Parameter Block and FSInfo fields that readboot() decodes, using values whose most significant byte has its high bit set. Each case checks two things: that fsck_msdosfs(8) reports the full unsigned 32-bit value back on stdout, and that nothing writes a sanitizer runtime error to stderr. The second check is what catches a byte-at-a-time decode. Shifting such a byte left by 24 is undefined, but every compiler we use wraps it into the same bit pattern, so the decoded value alone cannot tell a correct decode from an overflowing one. In a WITH_UBSAN build bsd.sanitizer.mk compiles with -fsanitize=undefined and -fsanitize-recover=undefined, so the shift is reported on stderr and execution continues, which the test can then assert on. Against the byte-at-a-time decode these cases fail in a WITH_UBSAN build and pass without it. Note that the stderr check also fails on unrelated undefined behavior that these images reach anywhere in fsck_msdosfs(8), which is intended. MFC after: 1 week
Diffstat (limited to 'secure/lib/libdes/testdes.pl')
0 files changed, 0 insertions, 0 deletions