Common/PointerWrap: Prevent reads/writes past the end of the buffer.

This commit is contained in:
Admiral H. Curtiss committed 2022-04-18 23:48:00 +02:00
1 parent 853cf4f818
commit ef760ee012
4 files changed
+51 -27

No files matched your search

@@ -459,6 +459,12 @@ void TextureCacheBase::SerializeTexture(AbstractTexture* tex, const TextureConfi
// needing to allocate/free an extra buffer.
u8* texture_data = p.DoExternal(total_size);
if (p.GetMode() == PointerWrap::MODE_MEASURE)
{
ERROR_LOG_FMT(VIDEO, "Couldn't acquire {} bytes for serializing texture.", total_size);
return;
}
if (!skip_readback)
{
// Save out each layer of the texture to the pointer.