<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    <small>Ooops,<br>
      I intended "max_num_spans = xmax - xmin + 1"<br>
      sorry for the confusion.<br>
    </small><br>
    On 10/17/2011 08:39 PM, Taekyun Kim wrote:
    <blockquote
      cite="mid:1318851547-4170-1-git-send-email-podain77@gmail.com"
      type="cite">
      <pre wrap="">From: Taekyun Kim <a class="moz-txt-link-rfc2396E" href="mailto:tkq.kim@samsung.com">&lt;tkq.kim@samsung.com&gt;</a>

X coordinate of a span can range between xmin and xmax. So we have
to allocate (xmax - xmin + 1) slots for spans.
---
 src/cairo-tor-scan-converter.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/cairo-tor-scan-converter.c b/src/cairo-tor-scan-converter.c
index b001bbd..de10f67 100644
--- a/src/cairo-tor-scan-converter.c
+++ b/src/cairo-tor-scan-converter.c
@@ -1428,12 +1428,15 @@ glitter_scan_converter_reset(
                              int xmax, int ymax)
 {
     glitter_status_t status;
+    int max_num_spans;
 
     converter-&gt;xmin = 0; converter-&gt;xmax = 0;
     converter-&gt;ymin = 0; converter-&gt;ymax = 0;
 
-    if (xmax - xmin &gt; ARRAY_LENGTH(converter-&gt;spans_embedded)) {
-        converter-&gt;spans = _cairo_malloc_ab (xmax - xmin,
+    max_num_spans = xmax - xmin - 1;
+
+    if (max_num_spans &gt; ARRAY_LENGTH(converter-&gt;spans_embedded)) {
+        converter-&gt;spans = _cairo_malloc_ab (max_num_spans,
                                              sizeof (cairo_half_open_span_t));
         if (unlikely (converter-&gt;spans == NULL))
             return _cairo_error (CAIRO_STATUS_NO_MEMORY);
</pre>
    </blockquote>
    <br>
  </body>
</html>