HomeFreeBSD

usr.bin/sort: Avoid UBSan errors

Description

usr.bin/sort: Avoid UBSan errors

UBSan complains about out-of-bounds accesses for zero-length arrays. To
avoid this we can use flexible array members. However, the C standard does
not allow for structures that only contain flexible array members, so we
move the length parameters into that structure too.

Split out from D28233.

Reviewed By: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31009

(cherry picked from commit d053fb22f6d3b6bb0f4e47e4507fefc20cbe0e32)

Details

Provenance
arichardsonAuthored on Jul 5 2021, 1:32 PM
Reviewer
markj
Differential Revision
D31009: usr.bin/sort: Avoid UBSan errors
Parents
rG22548a3b8070: Simplify and speed up the kyua build
Branches
Unknown
Tags
Unknown