[llvm] r310308 - [Object] Initialize LoadConfig member to null
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 7 14:23:38 PDT 2017
Author: rnk
Date: Mon Aug 7 14:23:38 2017
New Revision: 310308
URL: http://llvm.org/viewvc/llvm-project?rev=310308&view=rev
Log:
[Object] Initialize LoadConfig member to null
Executables may not contain a load config, and clients should be able to
test for nullability. Previously we'd return uninitialized memory. Now
getLoadConfig32/64 return valid pointers or null.
Fixes PR34108
Added:
llvm/trunk/test/tools/llvm-readobj/Inputs/coff-no-load-config.exe (with props)
Modified:
llvm/trunk/include/llvm/Object/COFF.h
llvm/trunk/test/tools/llvm-readobj/coff-load-config.test
Modified: llvm/trunk/include/llvm/Object/COFF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/COFF.h?rev=310308&r1=310307&r2=310308&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/COFF.h (original)
+++ llvm/trunk/include/llvm/Object/COFF.h Mon Aug 7 14:23:38 2017
@@ -753,7 +753,7 @@ private:
const debug_directory *DebugDirectoryBegin;
const debug_directory *DebugDirectoryEnd;
// Either coff_load_configuration32 or coff_load_configuration64.
- const void *LoadConfig;
+ const void *LoadConfig = nullptr;
std::error_code getString(uint32_t offset, StringRef &Res) const;
Added: llvm/trunk/test/tools/llvm-readobj/Inputs/coff-no-load-config.exe
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/Inputs/coff-no-load-config.exe?rev=310308&view=auto
==============================================================================
Binary file - no diff available.
Propchange: llvm/trunk/test/tools/llvm-readobj/Inputs/coff-no-load-config.exe
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: llvm/trunk/test/tools/llvm-readobj/coff-load-config.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/coff-load-config.test?rev=310308&r1=310307&r2=310308&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/coff-load-config.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/coff-load-config.test Mon Aug 7 14:23:38 2017
@@ -3,6 +3,8 @@ RUN: llvm-readobj -coff-load-config %S/I
RUN: llvm-readobj -coff-load-config %S/Inputs/coff-load-config-data-end.exe | FileCheck %s --check-prefix=DATAEND
+RUN: llvm-readobj -coff-load-config %S/Inputs/coff-no-load-config.exe | FileCheck %s --check-prefix=NOCONFIG
+
X86: LoadConfig [
X86: Size: 0x5C
X86: TimeDateStamp: 1970-01-01 00:00:00 (0x0)
@@ -91,3 +93,6 @@ X64: ]
DATAEND: SEHTable [
DATAEND-NEXT: 0x402006
DATAEND-NEXT: ]
+
+NOCONFIG: Format: COFF-x86-64
+NOCONFIG-NOT: LoadConfig
More information about the llvm-commits
mailing list