瀏覽代碼

testyuv: fix buffer overflow write

Anonymous Maarten 2 年之前
父節點
當前提交
ee13b74d59
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      test/testyuv.c

+ 1 - 1
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) {