]> granicus.if.org Git - llvm/commitdiff
Fix msan buildbot.
authorRui Ueyama <ruiu@google.com>
Fri, 16 Jun 2017 02:17:35 +0000 (02:17 +0000)
committerRui Ueyama <ruiu@google.com>
Fri, 16 Jun 2017 02:17:35 +0000 (02:17 +0000)
This patch should fix sanitizer-x86_64-linux-fast bot.

The problem was that the contents of this stream are aligned to 4 byte,
and the paddings were created just by incrementing `Offset`, so paddings
had undefined values. When the entire stream is written to an output,
it triggered msan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305541 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/BinaryStreamWriter.cpp

index b22eb1ed12d018221075647525777ef54352891e..9c47a5cf1f7408a93ffefad8afc84d74c9541c58 100644 (file)
@@ -83,6 +83,7 @@ Error BinaryStreamWriter::padToAlignment(uint32_t Align) {
   uint32_t NewOffset = alignTo(Offset, Align);
   if (NewOffset > getLength())
     return make_error<BinaryStreamError>(stream_error_code::stream_too_short);
-  Offset = NewOffset;
+  while (Offset < NewOffset)
+    writeInteger('\0');
   return Error::success();
 }