================
@@ -51,8 +51,14 @@ llvm::Expected<PathSeq> enumerateFiles(FileManager &FM,
StringRef Directory) {
if (EC)
return errorCodeToError(EC);
+ // Ensure the iterator is valid before dereferencing.
+ if (i == ie)
+ break;
+
// Skip files that do not exist. This usually happens for broken symlinks.
- if (FS.status(i->path()) == std::errc::no_such_file_or_directory)
+ auto StatusOrErr = FS.status(i->path());
+ if (!StatusOrErr ||
----------------
cyndyishida wrote:
I'm not sure about this either. Where is the possible null pointer access? I
also think `!StatusOrErr` is now too strict that we'd skip over other paths
that may have other errors that we may want to still store.
https://github.com/llvm/llvm-project/pull/97900
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits