diff options
author | Alexey Samsonov <vonosmas@gmail.com> | 2014-08-20 22:46:38 +0000 |
---|---|---|
committer | Alexey Samsonov <vonosmas@gmail.com> | 2014-08-20 22:46:38 +0000 |
commit | e5864c69a8a247f07b88b99cccc1032129cc27ac (patch) | |
tree | 8d5de85d600eb0812320fdff67e83b8c7701f05a /llvm/lib/MC/MCParser/AsmParser.cpp | |
parent | 50de57df6d0a706ea5451e1ccf8878d8298ae9c7 (diff) | |
download | bcm5719-llvm-e5864c69a8a247f07b88b99cccc1032129cc27ac.tar.gz bcm5719-llvm-e5864c69a8a247f07b88b99cccc1032129cc27ac.zip |
Don't allow MCStreamer::EmitIntValue to output 0-byte integers.
It makes no sense and can hide bugs. In particular, it lead
to left shift by 64 bits, which is an undefined behavior,
properly reported by UBSan.
llvm-svn: 216134
Diffstat (limited to 'llvm/lib/MC/MCParser/AsmParser.cpp')
-rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index c01f3acc661..aafc5e1850e 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -2612,7 +2612,8 @@ bool AsmParser::parseDirectiveFill() { for (uint64_t i = 0, e = NumValues; i != e; ++i) { getStreamer().EmitIntValue(FillExpr, NonZeroFillSize); - getStreamer().EmitIntValue(0, FillSize - NonZeroFillSize); + if (NonZeroFillSize < FillSize) + getStreamer().EmitIntValue(0, FillSize - NonZeroFillSize); } return false; |