[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.

Igor Oliveira igor.o at sisa.samsung.com
Tue Mar 20 17:54:25 PDT 2012


---
 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 =3D=3D CAIRO_GL_FLAVOR_ES &&
+       if ((ctx->gl_flavor =3D=3D CAIRO_GL_FLAVOR_ES &&
            (src->width * cpp < src->stride - 3 ||
-            width !=3D src->width))
+            width !=3D src->width)) ||
+           src->stride < 0)
        {
            glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
            status =3D _cairo_gl_surface_extract_image_data (src, src_x, sr=
c_y,
--=20
1.7.5.4

--_002_73E7C25EAD45E74E8CC051AA9CA388215B5C4Asjb3kcas1sisasams_
Content-Type: text/x-patch;
	name="0001-GL_UNPACK_ROW_LENGTH-does-not-accept-negative-values.patch"
Content-Description: 0001-GL_UNPACK_ROW_LENGTH-does-not-accept-negative-values.patch
Content-Disposition: attachment;
	filename="0001-GL_UNPACK_ROW_LENGTH-does-not-accept-negative-values.patch";
	size=1085; creation-date="Wed, 21 Mar 2012 01:03:25 GMT";
	modification-date="Wed, 21 Mar 2012 01:03:25 GMT"
Content-Transfer-Encoding: base64

RnJvbSBkYWY4YzRiMzcyYThmODk1YzJjMjNjOWYwZDZmMDE0ZDY3YzNhZjJjIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBJZ29yIE9saXZlaXJhIDxpZ29yLm9Ac2lzYS5zYW1zdW5nLmNv
bT4KRGF0ZTogVHVlLCAyMCBNYXIgMjAxMiAxN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