Submitted By: Ryan Oliver Submitted Date: 20140918T043000Z Initial Package Version: 1.12.16 Description: Do not decrement from MAXINT to 1 in byteswap code if width or stride == 0 diff -uNrw cairo-1.12.16-orig/src/cairo-xcb-surface-render.c cairo-1.12.16-mod/src/cairo-xcb-surface-render.c --- cairo-1.12.16-orig/src/cairo-xcb-surface-render.c 2013-08-27 01:07:21.000000000 +1000 +++ cairo-1.12.16-mod/src/cairo-xcb-surface-render.c 2014-09-18 13:05:46.071702400 +1000 @@ -4460,6 +4460,10 @@ const uint8_t *d; uint8_t *new, *n; + /* Probably a good idea to check if c is 0 before doing anything stupid */ + if (c == 0) + break; + new = malloc (c); if (unlikely (new == NULL)) { status = _cairo_error (CAIRO_STATUS_NO_MEMORY); @@ -4488,6 +4492,10 @@ const uint32_t *d; uint32_t *new, *n; + /* Probably a good idea to check if c is 0 before doing anything stupid */ + if (c == 0) + break; + new = malloc (4 * c); if (unlikely (new == NULL)) { status = _cairo_error (CAIRO_STATUS_NO_MEMORY); diff -uNrw cairo-1.12.16-orig/src/cairo-xlib-render-compositor.c cairo-1.12.16-mod/src/cairo-xlib-render-compositor.c --- cairo-1.12.16-orig/src/cairo-xlib-render-compositor.c 2013-08-27 01:07:21.000000000 +1000 +++ cairo-1.12.16-mod/src/cairo-xlib-render-compositor.c 2014-09-18 12:54:45.296037600 +1000 @@ -1287,6 +1287,10 @@ unsigned char *d; unsigned char *new, *n; + /* Probably a good idea to check if c is 0 before doing anything stupid */ + if (c == 0) + break; + new = malloc (c); if (!new) { status = _cairo_error (CAIRO_STATUS_NO_MEMORY); @@ -1312,6 +1316,10 @@ const uint32_t *d; uint32_t *new, *n; + /* Probably a good idea to check if c is 0 before doing anything stupid */ + if (c == 0) + break; + new = malloc (4 * c); if (unlikely (new == NULL)) { status = _cairo_error (CAIRO_STATUS_NO_MEMORY);