HomePhabricator

Fix various problems found by fuzzing.

Authored by klimek on Mon, Nov 22, 12:07 AM.

Description

Fix various problems found by fuzzing.

  1. IndexTokenSource::getNextToken cannot return nullptr; some code was

still written assuming it can; make getNextToken more resilient against
incorrect input and fix its call-sites.

  1. Change various asserts that can happen due to user provided input to

conditionals in the code.

Details

Committed
klimekMon, Nov 22, 2:08 AM
Parents
rGa82942dd07ea: Add missing clang-tidy args in index.rst (NFC)
Branches
Unknown
Tags
Unknown

Event Timeline

MyDeveloperDay added inline comments.
/clang/lib/Format/WhitespaceManager.cpp
375

does Fuzzying say this can somehow never happen?

1273

I'm pretty sure I've used this assert to tell me something has gone wrong, now we'll silently skip it, this could easily be more confusing.

klimek added inline comments.Mon, Nov 22, 2:47 AM
/clang/lib/Format/WhitespaceManager.cpp
1273

Given this can happen in (arguably contrived) input, not sure what the best way to address this is - we could potentially try to make sure we never get input like this here, but given fuzzing gives us random unicode sequences that clang is really bad at handling, not sure its worth it.
The alternative is to add a define that gives us "potentially reachable by weird user code" checks?