testsuite: Fix an asan error

asan complains that some of the memorytexture tests
read past limits. Avoid that.
This commit is contained in:
Matthias Clasen 2020-07-08 15:04:12 -04:00
parent e376d638fb
commit 8e73d007f5
2 changed files with 3 additions and 2 deletions

View File

@ -41,6 +41,7 @@ RUN dnf -y install \
itstool \
json-glib-devel \
lcov \
libasan \
libattr-devel \
libepoxy-devel \
libffi-devel \

View File

@ -93,7 +93,7 @@ create_texture (GdkMemoryFormat format,
guchar *data;
int x, y;
data = g_malloc (height * stride);
data = g_malloc (height * MAX (stride, tests[format].bytes_per_pixel));
for (y = 0; y < height; y++)
for (x = 0; x < width; x++)
{
@ -102,7 +102,7 @@ create_texture (GdkMemoryFormat format,
tests[format].bytes_per_pixel);
}
bytes = g_bytes_new_static (data, height * stride);
bytes = g_bytes_new_static (data, height * MAX (stride, tests[format].bytes_per_pixel));
texture = gdk_memory_texture_new (width, height,
format,
bytes,