Summary: | Calling cairo_image_surface_get_width/height() on the wrong type of surface | ||
---|---|---|---|
Product: | cairo | Reporter: | Pat Beirne <patbeirneottawa> |
Component: | general | Assignee: | Carl Worth <cworth> |
Status: | RESOLVED FIXED | QA Contact: | cairo-bugs mailing list <cairo-bugs> |
Severity: | normal | ||
Priority: | high | ||
Version: | 0.9.3 | ||
Hardware: | x86 (IA32) | ||
OS: | Linux (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
Pat Beirne
2005-07-23 12:33:58 UTC
*** Bug 3852 has been marked as a duplicate of this bug. *** *** Bug 3853 has been marked as a duplicate of this bug. *** It's definitely not legal code, but since we can catch it, it would be nice to be at least optionally verbose about these types of mistakes. [Copying from the mailing list discussion of the same issue: http://lists.freedesktop.org/archives/cairo/2005-July/004544.html ] Here's a simple patch that at the very least calls into _cairo_error with CAIRO_STATUS_SURFACE_TYPE_MISMATCH as it should in this case, and also returns 0 rather than garbage. The remaining question is whether this error should also set surface->status to CAIRO_STATUS_SURFACE_TYPE_MISMATCH to shut the surface down. That would be consistent with our error handling strategy of shutdown-on-error, and it does have the advantage of doing something to ensure the user can tell that _something_ is wrong. (After which the debugging approach could be to break on _cairo_debug or enable some print messages in _cairo_error that we don't have yet). Suggestions? Created attachment 3184 [details]
Strange painting in crack attack
date: 2005/07/28 17:47:40; author: cworth; state: Exp; lines: +10 -0 * src/cairo-image-surface.c: (cairo_image_surface_get_width), (cairo_image_surface_get_height): Fix to call _cairo_error and return 0 on surface-type mismatch. Move bugs against "cvs" version to "0.9.3" so we can remove the "cvs" version. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.