Fix UAF in SLVideo overlay update

This commit is contained in:
Cameron Gutman 2022-05-21 00:30:07 -05:00
parent 5ea79efe4b
commit 216f274a92

View file

@ -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);
}