<div dir="ltr"><div><div>Hello,<br><br></div>Please excuse me for creating a confusion. Here is the original source code with the comments regarding the crash.<br></div><div>cairo-image-compositor.c<br><br><font face="monospace">static cairo_status_t<br>_fill_xrgb32_lerp_opaque_spans (void *abstract_renderer, int y, int h,<br> const cairo_half_open_span_t *spans, unsigned num_spans)<br>{<br> cairo_image_span_renderer_t *r = abstract_renderer;<br><br> if (num_spans == 0)<br> return CAIRO_STATUS_SUCCESS;<br><br> if (likely(h == 1)) {<br> do {<br> uint8_t a = spans[0].coverage;<br> if (a) {<br> int len = spans[1].x - spans[0].x; </font><font face="monospace"> // = -1 causing a crash below<br> uint32_t *d = (uint32_t*)(r->u.fill.data + r->u.fill.stride*y + spans[0].x*4);<br> if (a == 0xff) {<br> if (len > 31) {<br> pixman_fill ((uint32_t *)r->u.fill.data, r->u.fill.stride / sizeof(uint32_t), 32,<br> spans[0].x, y, len, 1, r->u.fill.pixel);<br> } else {<br> uint32_t *d = (uint32_t*)(r->u.fill.data + r->u.fill.stride*y + spans[0].x*4);<br> while (len--)<br> *d++ = r->u.fill.pixel;<br> }<br> } else while (len--) {<br> *d = lerp8x4 (r->u.fill.pixel, a, *d); // the crash happens here, len < -20000<br> d++;<br> }<br> }<br> spans++;<br> } while (--num_spans > 1);<br> } else {<br> do {<br></font><br></div><div><br></div>With best regards,<br>Ilya<br><div><div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On 27 November 2014 at 01:04, Ilya Sakhnenko <span dir="ltr"><<a href="mailto:ilia.softway@gmail.com" target="_blank">ilia.softway@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hello,<br><br></div><div>First of all, million thanks for this beautiful library!<br></div>I have encountered a crash in _fill_xrgb32_lerp_opaque_spans (cairo 1.14.0, pixman 0.32.6):<br><br>I had to replace if (len--) to if (len-- > 0) to let our program run.<br><br>static cairo_status_t<br>_fill_xrgb32_lerp_opaque_spans (void *abstract_renderer, int y, int h,<br> const cairo_half_open_span_t *spans, unsigned num_spans)<br>{<br> cairo_image_span_renderer_t *r = abstract_renderer;<br><br> if (num_spans == 0)<br> return CAIRO_STATUS_SUCCESS;<br><br> if (likely(h == 1)) {<br> do {<br> uint8_t a = spans[0].coverage;<br> if (a) {<br> int len = spans[1].x - spans[0].x; // = -1 causing a crash<br> uint32_t *d = (uint32_t*)(r->u.fill.data + r->u.fill.stride*y + spans[0].x*4);<br> if (a == 0xff) {<br> if (len > 31) {<br> pixman_fill ((uint32_t *)r->u.fill.data, r->u.fill.stride / sizeof(uint32_t), 32,<br> spans[0].x, y, len, 1, r->u.fill.pixel);<br> } else {<br> uint32_t *d = (uint32_t*)(r->u.fill.data + r->u.fill.stride*y + spans[0].x*4);<br> while (len-- > 0)<br> *d++ = r->u.fill.pixel;<br> }<br> } else while (len-- > 0) { // crash len being negative (was -1 at the line 2238: int len = spans[1].x - spans[0].x)<br> *d = lerp8x4 (r->u.fill.pixel, a, *d);<br> d++;<br> }<br> }<br> spans++;<div><div>....<br><br></div><div>With best regards,<br>Ilya<br></div><div><br></div></div></div>
</blockquote></div><br></div></div></div></div></div></div>