mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-01 03:18:00 +02:00
Check surface->status and finished in cairo_surface_write_to_png
Without these checks, a user could hit an assertion failure by passing a finished surface to cairo_surface_write_to_png. Now we return a nice CAIRO_STATUS_SURFACE_FINISHED error in that case instead.
This commit is contained in:
parent
33c54ed240
commit
c1f7655f2f
1 changed files with 6 additions and 0 deletions
|
|
@ -285,6 +285,12 @@ cairo_surface_write_to_png (cairo_surface_t *surface,
|
|||
FILE *fp;
|
||||
cairo_status_t status;
|
||||
|
||||
if (surface->status)
|
||||
return surface->status;
|
||||
|
||||
if (surface->finished)
|
||||
return _cairo_error (CAIRO_STATUS_SURFACE_FINISHED);
|
||||
|
||||
fp = fopen (filename, "wb");
|
||||
if (fp == NULL) {
|
||||
switch (errno) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue