[PATCH] D51652: lld-link: Write an empty "repro" debug directory entry if /Brepro is passed

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 4 13:08:09 PDT 2018


rnk added inline comments.


================
Comment at: lld/COFF/Writer.cpp:114-115
 private:
+  void fillEntry(debug_directory *D, COFF::DebugType DebugType,
+		 size_t Size, uint64_t RVA, uint64_t Offs) const {
+    D->Characteristics = 0;
----------------
format?


================
Comment at: llvm/lib/Object/COFFObjectFile.cpp:640-641
   DebugDirectoryBegin = reinterpret_cast<const debug_directory *>(IntPtr);
-  if (std::error_code EC = getRvaPtr(
-          DataEntry->RelativeVirtualAddress + DataEntry->Size, IntPtr))
-    return EC;
-  DebugDirectoryEnd = reinterpret_cast<const debug_directory *>(IntPtr);
+  DebugDirectoryEnd = reinterpret_cast<const debug_directory *>(
+      IntPtr + DataEntry->Size);
   return std::error_code();
----------------
This seems like it loses the error check that the debug directory is in bounds. Is there a better idiom for ensuring that a range is inside the object?


https://reviews.llvm.org/D51652





More information about the llvm-commits mailing list