summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureCacheBase.cpp
diff options
context:
space:
mode:
authorMai M <mathew1800@gmail.com>2022-04-21 17:32:13 -0400
committerGitHub <noreply@github.com>2022-04-21 17:32:13 -0400
commit2e01dc0c82b5f73215e3425ab45ff6c7ee50b389 (patch)
treeac63ed8f2d8a175d937e71bfabf2f90e839a07e0 /Source/Core/VideoCommon/TextureCacheBase.cpp
parent3172199d3396da5ff08682dab526868807e7d50a (diff)
parentef760ee012a1a7a9d8997fecce4f0c9a7122e1bd (diff)
Merge pull request #10592 from AdmiralCurtiss/pointerwrap-protections
Common/PointerWrap: Prevent reads/writes past the end of the buffer.
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp
index 078abf10b1..b1c9ead97a 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -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.