[PATCH] COFFDumper: Dump data directory entries.

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Tue Jul 16 06:46:48 PDT 2013



================
Comment at: lib/Object/COFFObjectFile.cpp:46
@@ +45,3 @@
+  uintptr_t Addr = uintptr_t(Ptr);
+  if (Addr + Size < Addr ||
+      Addr + Size < Size ||
----------------
To test that [addr, addr + Size] is in M, you only need to check

Addr >= M->getBufferStart() && Addr+Size <= M->getBufferEnd(), no?

Can't you assert that it is true instead of returning an error?


================
Comment at: lib/Object/COFFObjectFile.cpp:613
@@ +612,3 @@
+                                            const data_directory *&Res) const {
+  // Error if if there's no data directory or the index is out of range.
+  if (!DataDirectory || index > PE32Header->NumberOfRvaAndSize)
----------------
Just returing a data_directory* (possibly null) would be a simpler interface.


http://llvm-reviews.chandlerc.com/D1148

BRANCH
  readobj

ARCANIST PROJECT
  llvm



More information about the llvm-commits mailing list