<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - self-copy crashes for a stack overflow with svg12 backend"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=88293">88293</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>self-copy crashes for a stack overflow with svg12 backend
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>cairo
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>pdf backend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>ajohnson@redneon.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sixtysix@inwind.it
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>cairo-bugs@cairographics.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=112093" name="attach_112093" title="quick hack">attachment 112093</a> <a href="attachment.cgi?id=112093&action=edit" title="quick hack">[details]</a></span>
quick hack

The problem is that with a paginated surface (pdf, svg)
 _cairo_recording_surface_break_self_copy_loop flushes
the internal recording surface, but not the parent which is
the snapshot_of of the paint source pattern. When later
detach_snapshots is invoked for the recording_surface
it creates a paint command that uses the same recording
surface as source and this results in a memory leak for
the pdf backend and an infinite recursion for the svg12
backend.

The attached quick hack flushes the pattern->surface before
adding the paint-command to the recording surface commands.


Reproduction step

(cd test && CAIRO_TEST_TARGET=pdf,svg12 .libs/cairo-test-suite -f self-copy)</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>