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

This commit is contained in:
Admiral H. Curtiss
2022-04-18 04:13:25 +02:00
parent 853cf4f818
commit ef760ee012
4 changed files with 51 additions and 27 deletions

View File

@ -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.