gl: Check the stride is a multiple of the bpp
authorBenjamin Otte <otte@redhat.com>
Sat, 9 Oct 2021 03:24:44 +0000 (05:24 +0200)
committerBenjamin Otte <otte@redhat.com>
Sat, 9 Oct 2021 03:25:41 +0000 (05:25 +0200)
gdk/gdkglcontext.c

index b1984d57b814d81ed500cd695615f19e10b23268..196e5fce4dfe87c5fd01667c6e96237daab4a02d 100644 (file)
@@ -308,7 +308,8 @@ gdk_gl_context_upload_texture (GdkGLContext    *context,
       glTexImage2D (texture_target, 0, gl_internalformat, width, height, 0, gl_format, gl_type, data);
       glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
     }
-  else if ((!gdk_gl_context_get_use_es (context) ||
+  else if (stride % bpp == 0 &&
+           (!gdk_gl_context_get_use_es (context) ||
             (priv->gl_version >= 30 || priv->has_unpack_subimage)))
     {
       glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / bpp);