forked from OSchip/llvm-project
Bugfix for collecting features from very small DSOs.
During unit tests, it was observed that crafting an artificially small DSO could cause OOB memory to be accessed. This change fixes that (but again, the affected DSOs are unlikely to ever occur outside unit tests). Reviewed By: morehouse, charco Differential Revision: https://reviews.llvm.org/D94507
This commit is contained in:
parent
3c4c205060
commit
10993bf072
|
@ -193,7 +193,7 @@ size_t ForEachNonZeroByte(const uint8_t *Begin, const uint8_t *End,
|
|||
Handle8bitCounter(FirstFeature, P - Begin, V);
|
||||
|
||||
// Iterate by Step bytes at a time.
|
||||
for (; P < End; P += Step)
|
||||
for (; P + Step <= End; P += Step)
|
||||
if (LargeType Bundle = *reinterpret_cast<const LargeType *>(P)) {
|
||||
Bundle = HostToLE(Bundle);
|
||||
for (size_t I = 0; I < Step; I++, Bundle >>= 8)
|
||||
|
|
Loading…
Reference in New Issue