1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

[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 046d03c020
commit d0f5096b25

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