[llvm] r184160 - [yaml2obj][ELF] Ensure more fields are zero'd.

Sean Silva silvas at purdue.edu
Mon Jun 17 18:11:21 PDT 2013


Author: silvas
Date: Mon Jun 17 20:11:21 2013
New Revision: 184160

URL: http://llvm.org/viewvc/llvm-project?rev=184160&view=rev
Log:
[yaml2obj][ELF] Ensure more fields are zero'd.

I was spotting garbage in the output. I'd like to just zero the entire
ELFYAML::Section to be sure, but it contains non-POD types. (I'm also
trying to avoid bloating the ELFYAML::Foo classes with a bunch of
constructor code).

No test, since this is by its very nature unpredictable. I'm pretty sure
that one of the sanitizers would catch it immediately though.

Modified:
    llvm/trunk/tools/yaml2obj/yaml2elf.cpp

Modified: llvm/trunk/tools/yaml2obj/yaml2elf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/yaml2obj/yaml2elf.cpp?rev=184160&r1=184159&r2=184160&view=diff
==============================================================================
--- llvm/trunk/tools/yaml2obj/yaml2elf.cpp (original)
+++ llvm/trunk/tools/yaml2obj/yaml2elf.cpp Mon Jun 17 20:11:21 2013
@@ -160,6 +160,8 @@ static int writeELF(raw_ostream &OS, con
     ELFYAML::Section S;
     S.Type = SHT_NULL;
     zero(S.Flags);
+    zero(S.Address);
+    zero(S.AddressAlign);
     Sections.insert(Sections.begin(), S);
   }
   // "+ 1" for string table.





More information about the llvm-commits mailing list