Skip to content
Commit a3a4369e authored by Justin Cady's avatar Justin Cady
Browse files

[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
parent 2878282d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment