[lld] r227081 - path.data() may return a non null terminated string
Jean-Daniel Dupas
devlists at shadowlab.org
Mon Jan 26 01:52:37 PST 2015
Author: jddupas
Date: Mon Jan 26 03:52:37 2015
New Revision: 227081
URL: http://llvm.org/viewvc/llvm-project?rev=227081&view=rev
Log:
path.data() may return a non null terminated string
and raw_fd_ostream constructor expects a StringRef.
Modified:
lld/trunk/lib/ReaderWriter/Native/WriterNative.cpp
lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
Modified: lld/trunk/lib/ReaderWriter/Native/WriterNative.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/Native/WriterNative.cpp?rev=227081&r1=227080&r2=227081&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/Native/WriterNative.cpp (original)
+++ lld/trunk/lib/ReaderWriter/Native/WriterNative.cpp Mon Jan 26 03:52:37 2015
@@ -68,7 +68,7 @@ public:
this->makeHeader();
std::error_code ec;
- llvm::raw_fd_ostream out(outPath.data(), ec, llvm::sys::fs::F_None);
+ llvm::raw_fd_ostream out(outPath, ec, llvm::sys::fs::F_None);
if (ec)
return ec;
Modified: lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp?rev=227081&r1=227080&r2=227081&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp (original)
+++ lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp Mon Jan 26 03:52:37 2015
@@ -1266,7 +1266,7 @@ public:
std::error_code writeFile(const lld::File &file, StringRef outPath) override {
// Create stream to path.
std::error_code ec;
- llvm::raw_fd_ostream out(outPath.data(), ec, llvm::sys::fs::F_Text);
+ llvm::raw_fd_ostream out(outPath, ec, llvm::sys::fs::F_Text);
if (ec)
return ec;
More information about the llvm-commits
mailing list