This is an archive of the discontinued LLVM Phabricator instance.

libfuzzer: Fix file listing on some filesystems
ClosedPublic

Authored by chouquette on Nov 14 2017, 8:07 AM.

Details

Summary

For some filesystems, readdir will not populate dirent::d_type with valuable information. This causes libfuzzer to proceed with an empty corpus, instead of the file it contains.

This has been tested on a server using XFS.

It should fix https://bugs.llvm.org//show_bug.cgi?id=25991

Diff Detail

Event Timeline

chouquette created this revision.Nov 14 2017, 8:07 AM
kcc edited edge metadata.Nov 14 2017, 8:47 AM

My usual question: is a test possible?

lib/fuzzer/FuzzerIOPosix.cpp
35

Please make this static, since it's not used outside of this file.

  • Making IsDirectory static

I'm not sure a test is possible without abstracting all calls to opendir/readdir/stat, allowing them to be mocked. Unless you had something more specific in mind?

kcc accepted this revision.Nov 14 2017, 8:59 AM

LGTM

This revision is now accepted and ready to land.Nov 14 2017, 8:59 AM

Thanks for the review!

I suppose I'll need someone to push this for me as I don't have access.

kcc closed this revision.Nov 15 2017, 8:45 AM