summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCAssembler.cpp
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2020-01-08 17:13:54 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2020-01-08 17:19:11 +0000
commit46e2f89364ce24a06953d08c78218fb5548a9fa3 (patch)
treea9ce3e4bcccd1927d5e4e5ef979f0781dfdc5a86 /llvm/lib/MC/MCAssembler.cpp
parent19bfb6d8df6c23c8c8d19af9221d12bf08244b51 (diff)
downloadbcm5719-llvm-46e2f89364ce24a06953d08c78218fb5548a9fa3.tar.gz
bcm5719-llvm-46e2f89364ce24a06953d08c78218fb5548a9fa3.zip
[MC] writeFragment - assert MCFragment::FT_Fill length is legal.
Silence (clang/MSVC) static analyzer warnings that the fragment data may either write out of bounds of the local array or reference uninitialized data.
Diffstat (limited to 'llvm/lib/MC/MCAssembler.cpp')
-rw-r--r--llvm/lib/MC/MCAssembler.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp
index 4a8421299f6..b30137aafb8 100644
--- a/llvm/lib/MC/MCAssembler.cpp
+++ b/llvm/lib/MC/MCAssembler.cpp
@@ -572,6 +572,7 @@ static void writeFragment(raw_ostream &OS, const MCAssembler &Asm,
unsigned VSize = FF.getValueSize();
const unsigned MaxChunkSize = 16;
char Data[MaxChunkSize];
+ assert(0 < VSize && VSize <= MaxChunkSize && "Illegal fragment fill size");
// Duplicate V into Data as byte vector to reduce number of
// writes done. As such, do endian conversion here.
for (unsigned I = 0; I != VSize; ++I) {
OpenPOWER on IntegriCloud