[ASAN] Fix validation size for dirent on FreeBSD
Typically the size required to represent a dirent is stored in `d_reclen`. But this not always the case for FreeBSD (for example, when walking a directory over NFS). This leads to ASAN false positives for `scandir` and similar functions. Because ASAN uses `d_reclen` for the range to validate, it can overrun when `d_reclen` is incorrect (too large). This change adds `__sanitizer_dirsiz` which fixes the dirent size calculation for FreeBSD. Other platforms continue to use `d_reclen`. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D151583
Loading
Please sign in to comment