[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.
This commit is contained in:
Simon Pilgrim 2020-01-08 17:13:54 +00:00
parent 19bfb6d8df
commit 46e2f89364
1 changed files with 1 additions and 0 deletions

View File

@ -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) {