From: Vedant Kumar Date: Sat, 10 Jun 2017 18:07:24 +0000 (+0000) Subject: Fix a ubsan failure introduced by r305092 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ce478a5667ffa36afe3c59ab39c6727d23266f18;p=llvm Fix a ubsan failure introduced by r305092 lib/Object/WindowsResource.cpp:578:3: runtime error: store to misaligned address 0x7fa09aedebbe for type 'unsigned int', which requires 4 byte alignment 0x7fa09aedebbe: note: pointer points here 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305149 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Object/WindowsResource.cpp b/lib/Object/WindowsResource.cpp index 041659e7aa2..3a1ed9a907a 100644 --- a/lib/Object/WindowsResource.cpp +++ b/lib/Object/WindowsResource.cpp @@ -574,8 +574,8 @@ void WindowsResourceCOFFWriter::writeSymbolTable() { void WindowsResourceCOFFWriter::writeStringTable() { // Just 4 null bytes for the string table. - auto COFFStringTable = reinterpret_cast(Current); - *COFFStringTable = 0; + auto COFFStringTable = reinterpret_cast(Current); + memset(COFFStringTable, 0, 4); } void WindowsResourceCOFFWriter::writeDirectoryTree() {