From: Simon McVittie <smcv@collabora.com>
Date: Mon, 22 Aug 2022 11:25:33 +0100
Subject: surface_test: Don't overlap pixel rows

SDL has the concept of pitch (sometimes referred to as stride or
rowstride in other imaging libraries, for example GNOME's GDK), which
is the number of bytes to advance through the data for each row/scanline.
Typically this is either exactly the number of bytes required to store
pixel data for a row, or a larger number chosen to align the beginning
of each row to a convenient memory address (for example a multiple of
16 bytes for SSE2).

Previously this test data used a fixed pitch of 16 bytes, even though
this is less than the memory required to store each 16-pixel row,
because each pixel uses 4 or 2 bytes of data (and therefore each 16-pixel
row is 64 or 32 bytes long). This meant SDL would start reading the
second row of pixels 16 bytes into the first row, and so on, with the
data for each row overlapping, and some unused bytes at the end. This
seems unlikely to have been intentional.

SDL 2.23.x and 2.24.0 have better validation for parameters, introduced
while adding overflow checks, which enforces that pixel rows do not
overlap (pitch < bytes per row). They may either have padding for better
alignment (pitch > bytes per row) or have no padding
(pitch == bytes per row, as seen after this commit).

Increase the pitch to match what was presumably intended.

Forwarded: not-needed, fixed differently in commit 7c44df68 "Start migrating surface tests to modern pytest"
---
 sdl2/test/surface_test.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sdl2/test/surface_test.py b/sdl2/test/surface_test.py
index 98abdf2..47878af 100644
--- a/sdl2/test/surface_test.py
+++ b/sdl2/test/surface_test.py
@@ -17,12 +17,12 @@ rgbdepths = (8, 12, 15, 16)
 rgbadepths = (16, 24, 32)
 
 rgba_pixelations_16x16 = (
-    # 32-bit 16x16 RGBA surface
-    ([x << 24 for x in range(16 * 16)], 32, 16,
+    # 32-bit 16x16 RGBA surface (64 bytes per row)
+    ([x << 24 for x in range(16 * 16)], 32, 64,
      (0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF),
      pixels.SDL_PIXELFORMAT_RGBA8888),
-    # 16-bit 16x16 RGBA surface
-    ([x << 8 for x in range(16 * 16)], 16, 16,
+    # 16-bit 16x16 RGBA surface (32 bytes per row)
+    ([x << 8 for x in range(16 * 16)], 16, 32,
      (0xF000, 0x0F00, 0x00F0, 0x000F),
      pixels.SDL_PIXELFORMAT_RGB444),
     )
