3
0
Fork 0
forked from suyu/suyu

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.
This commit is contained in:
ameerj 2021-10-08 01:22:38 -04:00
parent 5aae61775f
commit 403fc86c11

View file

@ -85,6 +85,15 @@ void Vic::Execute() {
if (!frame) { if (!frame) {
return; return;
} }
const u64 surface_width = config.surface_width_minus1 + 1;
const u64 surface_height = config.surface_height_minus1 + 1;
if (static_cast<u64>(frame->width) != surface_width ||
static_cast<u64>(frame->height) != surface_height) {
// TODO: Properly support multiple video streams with differing frame dimensions
LOG_WARNING(Debug, "Frame dimensions {}x{} do not match expected surface dimensions {}x{}",
frame->width, frame->height, surface_width, surface_height);
return;
}
switch (config.pixel_format) { switch (config.pixel_format) {
case VideoPixelFormat::RGBA8: case VideoPixelFormat::RGBA8:
case VideoPixelFormat::BGRA8: case VideoPixelFormat::BGRA8: