From 216f274a92a6626b329b7777ad67055077572fa5 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 21 May 2022 00:30:07 -0500 Subject: [PATCH] Fix UAF in SLVideo overlay update --- app/streaming/video/slvid.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/streaming/video/slvid.cpp b/app/streaming/video/slvid.cpp index 5778217f..dab250be 100644 --- a/app/streaming/video/slvid.cpp +++ b/app/streaming/video/slvid.cpp @@ -204,14 +204,14 @@ void SLVideoDecoder::notifyOverlayUpdated(Overlay::OverlayType type) SDL_ConvertPixels(newSurface->w, newSurface->h, newSurface->format->format, newSurface->pixels, newSurface->pitch, SDL_PIXELFORMAT_ARGB8888, pixels, pitch); - // We're done with the surface now - SDL_FreeSurface(newSurface); - // Position the status overlay at the bottom left corner float flWidth = (float)newSurface->w / m_ViewportWidth; float flHeight = (float)newSurface->h / m_ViewportHeight; SLVideo_SetOverlayDisplayArea(m_Overlay, 0.0f, 1.0f - flHeight, flWidth, flHeight); + // We're done with the surface now + SDL_FreeSurface(newSurface); + // Show the overlay SLVideo_ShowOverlay(m_Overlay); }