patch Cairo to avoid writing to a global constant

This bug is already fixed in the Cairo source repo, so we
can discard the patch on the next Cairo upgrade.

It's not clear which platforms are affected. On OS X, at least,
writing to a global constant can cause a crash.

Thanks to Spencer for making a small example that triggers the bug
(added to the "draw-test" package).
This commit is contained in:
Matthew Flatt 2015-11-06 15:49:50 -07:00
parent b6939b0b2e
commit 4d9c5d8dd2
2 changed files with 21 additions and 0 deletions

View File

@ -116,6 +116,9 @@
;; Avoid CGFontGetGlyphPath:
(define-runtime-path cairo-cgfontgetglpyh-patch "patches/cgfontgetglyph.patch")
;; Patch to avoid writing to a global constant:
(define-runtime-path cairo-allclipmodifybug-patch "patches/allclipmodifybug.patch")
;; Hack to workaround broken Courier New in Mac OS X 10.{7.8}:
(define-runtime-path courier-new-patch "patches/courier-new.patch")
@ -419,6 +422,7 @@
null)
#:patches (list cairo-coretext-patch
cairo-cgfontgetglpyh-patch
cairo-allclipmodifybug-patch
courier-new-patch
win32cairofallback-patch))]
[("harfbuzz") (config #:depends '("fontconfig" "freetype" "cairo")

View File

@ -0,0 +1,17 @@
diff -u -r old/cairo-1.12.16/src/cairo-clip-boxes.c new/cairo-1.12.16/src/cairo-clip-boxes.c
--- old/cairo-1.12.16/src/cairo-clip-boxes.c 2015-11-06 15:46:30.000000000 -0700
+++ new/cairo-1.12.16/src/cairo-clip-boxes.c 2015-11-06 15:47:36.000000000 -0700
@@ -172,8 +172,11 @@
if (clip->path == NULL) {
clip->extents = *r;
} else {
- if (! _cairo_rectangle_intersect (&clip->extents, r))
+ if (! _cairo_rectangle_intersect (&clip->extents, r)) {
clip = _cairo_clip_set_all_clipped (clip);
+ /* return so that there's no attempt to modify `clip`: */
+ return clip;
+ }
}
if (clip->path == NULL)
clip->is_region = _cairo_box_is_pixel_aligned (box);
Only in new/cairo-1.12.16/src: cairo-clip-boxes.c~