This is an archive of the discontinued LLVM Phabricator instance.

[pseudo] Add fuzzer for the pseudoparser.
ClosedPublic

Authored by sammccall on May 5 2022, 1:00 PM.

Details

Summary

As confirmation, running this locally found 2 crashes:

  • trivial: crashes on file with no tokens
  • lexer: hits an assertion failure on bytes: 0x5c,0xa,0x5c,0x1,0x65,0x5c,0xa

Diff Detail

Event Timeline

sammccall created this revision.May 5 2022, 1:00 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 5 2022, 1:00 PM
Herald added a subscriber: mgorny. · View Herald Transcript
sammccall requested review of this revision.May 5 2022, 1:00 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 5 2022, 1:00 PM
hokein accepted this revision.May 5 2022, 10:25 PM

Nice!

clang-tools-extra/pseudo/fuzzer/Fuzzer.cpp
82

nit: I'd suggest using another name -- O looks similar to the number literal 0.

This revision is now accepted and ready to land.May 5 2022, 10:25 PM
sammccall marked an inline comment as done.May 6 2022, 12:22 AM
sammccall added inline comments.
clang-tools-extra/pseudo/fuzzer/Fuzzer.cpp
82

Realized I can use std::remove_if here instead which is cleaner.

This revision was automatically updated to reflect the committed changes.
sammccall marked an inline comment as done.

This adds a false dependency between check-clang-pseudo and all of LLVM via the FuzzMutate library.
(We use FuzzerCLI.h, but there's also a bunch of utilities for fuzzing IR).
I'll try to split that library up to avoid the false dependency in a followup.