summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar ameerj2021-10-08 01:22:38 -0400
committerGravatar ameerj2021-10-08 01:22:38 -0400
commit403fc86c1138821fac375a2ac850ac787969e2c8 (patch)
tree5ac804c64f72bb16dd8c1477db71cf35419e18a7 /src
parentvic: Refactor frame writing methods (diff)
downloadyuzu-403fc86c1138821fac375a2ac850ac787969e2c8.tar.gz
yuzu-403fc86c1138821fac375a2ac850ac787969e2c8.tar.xz
yuzu-403fc86c1138821fac375a2ac850ac787969e2c8.zip
vic: Avoid memory corruption when multiple streams with different dimensions are decoded
This is a work around to avoid buffer overflow errors until multi channel/multi stream decoding is supported.
Diffstat (limited to '')
-rw-r--r--src/video_core/command_classes/vic.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/video_core/command_classes/vic.cpp b/src/video_core/command_classes/vic.cpp
index 3f2712a8d..51f739801 100644
--- a/src/video_core/command_classes/vic.cpp
+++ b/src/video_core/command_classes/vic.cpp
@@ -85,6 +85,15 @@ void Vic::Execute() {
85 if (!frame) { 85 if (!frame) {
86 return; 86 return;
87 } 87 }
88 const u64 surface_width = config.surface_width_minus1 + 1;
89 const u64 surface_height = config.surface_height_minus1 + 1;
90 if (static_cast<u64>(frame->width) != surface_width ||
91 static_cast<u64>(frame->height) != surface_height) {
92 // TODO: Properly support multiple video streams with differing frame dimensions
93 LOG_WARNING(Debug, "Frame dimensions {}x{} do not match expected surface dimensions {}x{}",
94 frame->width, frame->height, surface_width, surface_height);
95 return;
96 }
88 switch (config.pixel_format) { 97 switch (config.pixel_format) {
89 case VideoPixelFormat::RGBA8: 98 case VideoPixelFormat::RGBA8:
90 case VideoPixelFormat::BGRA8: 99 case VideoPixelFormat::BGRA8: