[cairo] [PATCH] fix a crash caused by finished SVG surface

Kouhei Sutou kou at cozmixng.org
Mon Oct 28 14:42:47 CET 2013


Hi,

I attach a patch that fix a crash that is caused by finished
SVG surface. "cairo_create (finished_svg_surface)" is invalid
usage but it will be better that reporting an error instead
of crash.

Here is a program that reproduces this case:

#include <cairo.h>
#include <cairo-svg.h>

int
main(int argc, char **argv)
{
  cairo_t *cr;
  cairo_surface_t *finished_surface;

  finished_surface = cairo_svg_surface_create ("/tmp/xxx.svg", 1.0, 1.0);
  cairo_surface_finish (finished_surface);

  cr = cairo_create (finished_surface);
  cairo_destroy (cr);

  cairo_surface_destroy (finished_surface);

  return 0;
}

We can use other paginated surface such as PDF surface for
finished surface.


This case is reported at rcairo's issue:
https://github.com/rcairo/rcairo/issues/15


Thanks,
--
kou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-cairo_create-Add-finished-surface-check.patch
Type: text/x-patch
Size: 1334 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20131028/a6819f1b/attachment.bin>


More information about the cairo mailing list