[PATCH] D52721: [Preprocessor] Fix a crash when handling non-alpha include header.
Kristina Brooks via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 1 05:35:19 PDT 2018
kristina added inline comments.
================
Comment at: lib/Lex/PPDirectives.cpp:1892
if (!File) {
- while (!isAlphanumeric(Filename.front())) {
+ while (!Filename.empty() && !isAlphanumeric(Filename.front())) {
Filename = Filename.drop_front();
----------------
kristina wrote:
> This line is tripping the assert, it seems best course of action would be a single check here and then just diagnosing an error unless you have managed to find other cases, in which case all the checks below are also warranted.
In either case, the diagnostic emitted doesn't really make sense, at least to me, I think it would be better to explicitly diagnose this case as an error and then bail, before an assertion fires.
I also crashed clang with `#include "./"`, so the test case does seem to be fairly minimal which is good. Though I think a diagnostic about a bogus file path would be better (I don't know how to word it well), rather than saying file not found.
Repository:
rC Clang
https://reviews.llvm.org/D52721
More information about the cfe-commits
mailing list