From 7926347c8b18102b2916525eccc0c17e876cef5b Mon Sep 17 00:00:00 2001 From: Matt Borgerson Date: Wed, 10 Feb 2021 23:13:26 -0700 Subject: [PATCH] nv2a: Fix buffer size in surface flip --- hw/xbox/nv2a/pgraph.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/xbox/nv2a/pgraph.c b/hw/xbox/nv2a/pgraph.c index 91b77b8fa8..5104c75009 100644 --- a/hw/xbox/nv2a/pgraph.c +++ b/hw/xbox/nv2a/pgraph.c @@ -4284,7 +4284,8 @@ static void pgraph_upload_surface_data( } // This is VRAM so we can't do this inplace! - uint8_t *flipped_buf = (uint8_t*)g_malloc(surface->size); + uint8_t *flipped_buf = (uint8_t *)g_malloc( + surface->height * surface->width * surface->bytes_per_pixel); unsigned int irow; for (irow = 0; irow < surface->height; irow++) { memcpy(&flipped_buf[surface->width * (surface->height - irow - 1)