[gtk/matthiasc/for-master: 4/5] testsuite: Fix an asan error
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master: 4/5] testsuite: Fix an asan error
- Date: Wed, 8 Jul 2020 19:10:07 +0000 (UTC)
commit 8e73d007f574181f85b5642b0f0d8773968d4ec6
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Jul 8 15:04:12 2020 -0400
testsuite: Fix an asan error
asan complains that some of the memorytexture tests
read past limits. Avoid that.
.gitlab-ci/fedora-base.Dockerfile | 1 +
testsuite/gdk/memorytexture.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/.gitlab-ci/fedora-base.Dockerfile b/.gitlab-ci/fedora-base.Dockerfile
index 0237b3804b..c9e428d54c 100644
--- a/.gitlab-ci/fedora-base.Dockerfile
+++ b/.gitlab-ci/fedora-base.Dockerfile
@@ -41,6 +41,7 @@ RUN dnf -y install \
itstool \
json-glib-devel \
lcov \
+ libasan \
libattr-devel \
libepoxy-devel \
libffi-devel \
diff --git a/testsuite/gdk/memorytexture.c b/testsuite/gdk/memorytexture.c
index b43281e6b2..3f941cdb29 100644
--- a/testsuite/gdk/memorytexture.c
+++ b/testsuite/gdk/memorytexture.c
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]