[cairo] 0-length array in c986a7310bb06582b7d8a566d5f007ba4e5e75bf

Albert Chin cairo at mlists.thewrittenword.com
Tue Sep 3 14:34:58 PDT 2013


Commit c986a7310bb06582b7d8a566d5f007ba4e5e75bf introduced the
following code to src/cairo-image-compositor.c:
--- a/src/cairo-image-compositor.c
+++ b/src/cairo-image-compositor.c
@@ -1547,7 +1547,8 @@ typedef struct _cairo_image_span_renderer {
            uint8_t *data;
        } mask;
     } u;
-    uint8_t buf[sizeof(cairo_abstract_span_renderer_t)-128];
+    uint8_t _buf[0];
+#define SZ_BUF (sizeof (cairo_abstract_span_renderer_t) - sizeof (cairo_image_span_renderer_t))
 } cairo_image_span_renderer_t;
 COMPILE_TIME_ASSERT (sizeof (cairo_image_span_renderer_t) <= sizeof (cairo_abstract_span_renderer_t));

The Solaris 8 compiler and the HP-UX/IA compilers don't like the
above. The Solaris 8 compiler errors with:
  "cairo-image-compositor.c", line 1551: zero or negative subscript
and the HP-UX/IA compilers error with:
  "cairo-image-compositor.c", line 1551: error #2094: the size of an array must
            be greater than zero
        uint8_t _buf[0];
                     ^

-- 
albert chin (china at thewrittenword.com)


More information about the cairo mailing list