Summary: | _cairo_clip_set_all_clipped returns const value as non-const, caller modifies it -> crash on some platforms | ||
---|---|---|---|
Product: | cairo | Reporter: | Andrew de los Reyes <andrew-freedesktop> |
Component: | general | Assignee: | Uli Schlachter <psychon> |
Status: | RESOLVED FIXED | QA Contact: | cairo-bugs mailing list <cairo-bugs> |
Severity: | normal | ||
Priority: | medium | CC: | andrew-freedesktop, mitar.freedesktop |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: | Make sure _cairo_clip_intersect_rectangle_box() doesn't get with the all-clipped clip |
Description
Andrew de los Reyes
2014-03-06 03:32:46 UTC
Created attachment 95210 [details] [review] Make sure _cairo_clip_intersect_rectangle_box() doesn't get with the all-clipped clip I wonder what Mac OS is doing differently than everyone else... According to the stacktrace on the poppler bug report, the __cairo_clip_all constant is in the .text section. Weird. Since we have no test case: Does the attached patch help? Uli, your patch fixes another issue, please push. commit 3b261bea7d8e8094ff3899aefab6bbc8628a3585 Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Thu Mar 6 08:34:10 2014 +0000 clip: Do not modify the special all-clipped cairo_clip_t Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75819 Chris, done. For something completely different (which really doesn't belong into this comment): Could you take a look at _cairo_clip_reduce_to_boxes()? That function has an unconditional "return clip" with wrong indentation as its first executed statement. That doesn't seem right... commit ed175b2a2bebb6def85133257bc11a875d13b0dd Author: Uli Schlachter <psychon@znc.in> Date: Thu Mar 6 09:45:08 2014 +0100 clip: Fix handling of special all-clipped cairo_clip_t _cairo_clip_intersect_box() wasn't checking if it was called with the special, read-only all-clipped clip and thus could have ended up writing to read-only memory. References: https://bugs.freedesktop.org/show_bug.cgi?id=75819 Signed-off-by: Uli Schlachter <psychon@znc.in> I vaguely remember I never convinced myself that the path walking would be a win - or rather would more often be a loss than a win. So I left the code in just in case it turned out to be a good idea. Hey, thanks for the quick response, but I verified that patch unfortunately doesn't fix the issue. Have a closer look at the code snippets I posted when I first created this issue. Specifically, the body of _cairo_clip_intersect_rectangle_box . Note that this function is called with a perfectly mutable clip, but it then calls _cairo_clip_set_all_clipped which returns the immutable clip, which is then mutated. You are right that my patch doesn't fix this issue. However, while I didn't figure out this bug, Chris did (and it was him who closed this). His patch is already in git. It can be found e.g. here: http://cgit.freedesktop.org/cairo/commit/?id=3b261bea7d8e8094ff3899aefab6bbc8628a3585 Thanks. I've verified that his patch fixes the issue. Thanks again! |
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.