[PATCH] GL_UNPACK_ROW_LENGTH does not accept negative values

Igor Oliveira <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <73E7C25EAD45E74E8CC051AA9CA388215B5C4A@sj-b3k-cas1.sisa.samsung.com>
This patch fixes the negative-stride-image test.

From daf8c4b372a8f895c2c23c9f0d6f014d67c3af2c Mon Sep 17 00:00:00 2001
From: Igor Oliveira <[email protected]>
Date: Tue, 20 Mar 2012 17:54:25 -0700
Subject: [PATCH] GL_UNPACK_ROW_LENGTH does not accept negative values. So
 when we have a negative stride we should fallback for the
 slow code path.

---
 src/cairo-gl-surface.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 95b4d7c..7108564 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -845,9 +845,10 @@ _cairo_gl_surface_draw_image (cairo_gl_surface_t *dst,
         * b. the row stride cannot be handled by GL itself using a 4 byte
         *     alignment constraint
         */
-       if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES &&
+       if ((ctx->gl_flavor == CAIRO_GL_FLAVOR_ES &&
            (src->width * cpp < src->stride - 3 ||
-            width != src->width))
+            width != src->width)) ||
+           src->stride < 0)
        {
            glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
            status = _cairo_gl_surface_extract_image_data (src, src_x, src_y,
-- 
1.7.5.4

--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
0001-GL_UNPACK_ROW_LENGTH-does-not-accept-negative-values.patch (text/x-patch, 1.1 KB)
From daf8c4b372a8f895c2c23c9f0d6f014d67c3af2c Mon Sep 17 00:00:00 2001
From: Igor Oliveira <[email protected]>
Date: Tue, 20 Mar 2012 17:54:25 -0700
Subject: [PATCH] GL_UNPACK_ROW_LENGTH does not accept negative values. So
 when we have a negative stride we should fallback for the
 slow code path.

---
 src/cairo-gl-surface.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 95b4d7c..7108564 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -845,9 +845,10 @@ _cairo_gl_surface_draw_image (cairo_gl_surface_t *dst,
 	 * b. the row stride cannot be handled by GL itself using a 4 byte
 	 *     alignment constraint
 	 */
-	if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES &&
+	if ((ctx->gl_flavor == CAIRO_GL_FLAVOR_ES &&
 	    (src->width * cpp < src->stride - 3 ||
-	     width != src->width))
+	     width != src->width)) ||
+	    src->stride < 0)
 	{
 	    glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
 	    status = _cairo_gl_surface_extract_image_data (src, src_x, src_y,
-- 
1.7.5.4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.