0002-SDL_x11yuv.c-fix-possible-use-after-free.patch 1.0 KB

12345678910111213141516171819202122232425262728
  1. From d7e00208738a0bc6af302723fe64908ac35b777b Mon Sep 17 00:00:00 2001
  2. From: Ozkan Sezer <sezeroz@gmail.com>
  3. Date: Sat, 18 Jun 2022 14:55:00 +0300
  4. Subject: [PATCH] SDL_x11yuv.c: fix possible use-after-free
  5. Fixes: https://github.com/libsdl-org/SDL-1.2/issues/863
  6. Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
  7. ---
  8. src/video/x11/SDL_x11yuv.c | 2 +-
  9. 1 file changed, 1 insertion(+), 1 deletion(-)
  10. diff --git a/src/video/x11/SDL_x11yuv.c b/src/video/x11/SDL_x11yuv.c
  11. index 62698dfd..0d5754e3 100644
  12. --- a/src/video/x11/SDL_x11yuv.c
  13. +++ b/src/video/x11/SDL_x11yuv.c
  14. @@ -374,8 +374,8 @@ SDL_Overlay *X11_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, S
  15. #ifdef PITCH_WORKAROUND
  16. if ( hwdata->image != NULL && hwdata->image->pitches[0] != (width*bpp) ) {
  17. /* Ajust overlay width according to pitch */
  18. - XFree(hwdata->image);
  19. width = hwdata->image->pitches[0] / bpp;
  20. + XFree(hwdata->image);
  21. hwdata->image = SDL_NAME(XvCreateImage)(GFX_Display, xv_port, format,
  22. 0, width, height);
  23. }
  24. --
  25. 2.30.2