Merge pull request #4207 from jakrams/msft-jakras-fix-corrupted-accessor

Prevent out-of-range memory writes by sparse accessors
This commit is contained in:
Kim Kulling
2021-11-26 09:02:17 +01:00
committed by GitHub

View File

@@ -809,6 +809,11 @@ inline void Accessor::Sparse::PatchData(unsigned int elementSize) {
}
offset *= elementSize;
if (offset + elementSize > data.size()) {
throw DeadlyImportError("Invalid sparse accessor. Byte offset for patching points outside allocated memory.");
}
std::memcpy(data.data() + offset, pValues, elementSize);
pValues += elementSize;