SDL: testyuv: fix buffer overflow write

From ee13b74d59ba151246f5388b19d26f9392d123ad Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Fri, 17 Mar 2023 02:24:15 +0100
Subject: [PATCH] testyuv: fix buffer overflow write

---
 test/testyuv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/testyuv.c b/test/testyuv.c
index 143ebd6d7dde..3ab4cedf46e5 100644
--- a/test/testyuv.c
+++ b/test/testyuv.c
@@ -34,7 +34,7 @@ static SDL_Surface *generate_test_pattern(int pattern_size)
         const int thickness = 2; /* Important so 2x2 blocks of color are the same, to avoid Cr/Cb interpolation over pixels */
 
         /* R, G, B in alternating horizontal bands */
-        for (y = 0; y < pattern->h; y += thickness) {
+        for (y = 0; y < pattern->h - (thickness - 1); y += thickness) {
             for (i = 0; i < thickness; ++i) {
                 p = (Uint8 *)pattern->pixels + (y + i) * pattern->pitch + ((y / thickness) % 3);
                 for (x = 0; x < pattern->w; ++x) {