File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 2222#include " llvm/ADT/Statistic.h"
2323#include " llvm/Config/llvm-config.h"
2424#include " llvm/Support/FileSystem.h"
25+ #include " llvm/Support/IOSandbox.h"
2526#include " llvm/Support/MemoryBuffer.h"
2627#include " llvm/Support/Path.h"
2728#include " llvm/Support/raw_ostream.h"
@@ -347,12 +348,15 @@ llvm::Expected<FileEntryRef> FileManager::getSTDIN() {
347348 if (STDIN)
348349 return *STDIN;
349350
350- std::unique_ptr<llvm::MemoryBuffer> Content;
351- if (auto ContentOrError = llvm::MemoryBuffer::getSTDIN ())
352- Content = std::move (*ContentOrError);
353- else
351+ auto ContentOrError = [] {
352+ auto BypassSandbox = llvm::sys::sandbox::scopedDisable ();
353+ return llvm::MemoryBuffer::getSTDIN ();
354+ }();
355+
356+ if (!ContentOrError)
354357 return llvm::errorCodeToError (ContentOrError.getError ());
355358
359+ auto Content = std::move (*ContentOrError);
356360 STDIN = getVirtualFileRef (Content->getBufferIdentifier (),
357361 Content->getBufferSize (), 0 );
358362 FileEntry &FE = const_cast <FileEntry &>(STDIN->getFileEntry ());
You can’t perform that action at this time.
0 commit comments