[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] [MC][AsmParser]: Don't use SourceMgr::AddIncludeFile when opening .incbin files (PR #194254)
Alexis Engelke via lldb-commits
lldb-commits at lists.llvm.org
Sat May 2 06:18:55 PDT 2026
================
@@ -246,6 +261,28 @@ RealFile::getBuffer(const Twine &Name, int64_t FileSize,
IsVolatile);
}
+ErrorOr<std::unique_ptr<MemoryBuffer>>
+RealFile::getSliceBuffer(const Twine &Name, int64_t Offset, int64_t Count,
+ bool IsVolatile) {
+ auto BypassSandbox = sys::sandbox::scopedDisable();
+ assert(Offset >= 0 && "Negative Offset");
+
+ if (Count == -1) {
+ uint64_t FileSize;
+ std::error_code Error = sys::fs::file_size(Name, FileSize);
----------------
aengelke wrote:
This is unsafe, the file might change between the size query and the actual open. Don't use the file name if you have an FD. I also don't quite see why this logic for Count==-1 is needed at all, shouldn't getOpenFileImpl already handle this?
https://github.com/llvm/llvm-project/pull/194254
More information about the lldb-commits
mailing list