File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -343,7 +343,13 @@ extractSystemIncludesAndTarget(const DriverArgs &InputArgs,
343
343
SPAN_ATTACH (Tracer, " driver" , Driver);
344
344
SPAN_ATTACH (Tracer, " lang" , InputArgs.Lang );
345
345
346
- if (!QueryDriverRegex.match (Driver)) {
346
+ // If driver was "../foo" then having to allowlist "/path/a/../foo" rather
347
+ // than "/path/foo" is absurd.
348
+ // Allow either to match the allowlist, then proceed with "/path/a/../foo".
349
+ // This was our historical behavior, and it *could* resolve to something else.
350
+ llvm::SmallString<256 > NoDots (Driver);
351
+ llvm::sys::path::remove_dots (NoDots, /* remove_dot_dot=*/ true );
352
+ if (!QueryDriverRegex.match (Driver) && !QueryDriverRegex.match (NoDots)) {
347
353
vlog (" System include extraction: not allowed driver {0}" , Driver);
348
354
return std::nullopt;
349
355
}
You can’t perform that action at this time.
0 commit comments