Add upstream patches to fix several crashes. Should fix bug #541326 (heap corruption...
authorAlexandre Rostovtsev <tetromino@gentoo.org>
Thu, 5 Mar 2015 18:23:03 +0000 (18:23 +0000)
committerAlexandre Rostovtsev <tetromino@gentoo.org>
Thu, 5 Mar 2015 18:23:03 +0000 (18:23 +0000)
Package-Manager: portage-2.2.18/cvs/Linux x86_64
Manifest-Sign-Key: 0x18E5B6F2D8D5EC8D

x11-libs/cairo/ChangeLog
x11-libs/cairo/Manifest
x11-libs/cairo/cairo-1.14.0-r2.ebuild [new file with mode: 0644]
x11-libs/cairo/files/cairo-1.14.0-CFF-unaligned-access.patch [new file with mode: 0644]
x11-libs/cairo/files/cairo-1.14.0-image-negative-span-length.patch [new file with mode: 0644]
x11-libs/cairo/files/cairo-1.14.0-tor-scan-converter-do_fullrow-intersection.patch [new file with mode: 0644]
x11-libs/cairo/files/cairo-1.14.0-xcb-0-sized-glyph.patch [new file with mode: 0644]
x11-libs/cairo/files/cairo-1.14.0-xlib-0-sized-glyph.patch [new file with mode: 0644]

index b43a1ab1b25bef34a529ecd1c9ce27cdb9568320..7ca76eba48bb2ebffd5d1b9db34e16106e266fc2 100644 (file)
@@ -1,6 +1,17 @@
 # ChangeLog for x11-libs/cairo
 # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/x11-libs/cairo/ChangeLog,v 1.408 2015/03/02 09:20:51 ago Exp $
+# $Header: /var/cvsroot/gentoo-x86/x11-libs/cairo/ChangeLog,v 1.409 2015/03/05 18:22:53 tetromino Exp $
+
+*cairo-1.14.0-r2 (05 Mar 2015)
+
+  05 Mar 2015; Alexandre Rostovtsev <tetromino@gentoo.org>
+  +cairo-1.14.0-r2.ebuild, +files/cairo-1.14.0-CFF-unaligned-access.patch,
+  +files/cairo-1.14.0-image-negative-span-length.patch,
+  +files/cairo-1.14.0-tor-scan-converter-do_fullrow-intersection.patch,
+  +files/cairo-1.14.0-xcb-0-sized-glyph.patch,
+  +files/cairo-1.14.0-xlib-0-sized-glyph.patch:
+  Add upstream patches to fix several crashes. Should fix bug #541326 (heap
+  corruption in darktable and evince), thanks to sergeev917 and Andrey Volkov.
 
   02 Mar 2015; Agostino Sarubbo <ago@gentoo.org> cairo-1.12.18-r1.ebuild:
   Stable for ppc, wrt bug #540676
index ff1d125287835e9a5c3c3be9f2e5e83d0e9f8136..0a901852e3de5418c9fe802906ff7837300f1f9f 100644 (file)
@@ -11,7 +11,12 @@ AUX cairo-1.12.16-all-clipped-2.patch 959 SHA256 f44543a285c36a6433319d3ac95e7a3
 AUX cairo-1.12.16-all-clipped-3.patch 982 SHA256 4fed4974b303e16a67a295683a591fd594706b930d829488b6a87b12c8a17994 SHA512 32ebbaa05fff024bd8493aef350935b2fec098482ac90283b524c4e2ccd6b9f60e1053b7585f5f679b45eb463726c0b4291d840b51bc36e8477d92576ef33c7f WHIRLPOOL e564da5f1aa12990c4470b49f8cf72126530b7189897194c1d2ca6e7c50ddf8ba21c7ef5b037f1ecc53d46c747345f28f0d770bbf882aaef6c03f8c6305d3ba0
 AUX cairo-1.12.16-lto-optional.patch 794 SHA256 7f7c7e7c13c6920019ae8663f3b6d829a250967ddedc13d69614bfe89bf8e327 SHA512 cadbfff501075201800eec9b712f9f7859b2ff1e6fa4f7d0ea09b3c06e43f49b4d2d7c665ad91d90c95e71036875790ce2a5e3b24f11da160e93c4b0ed140c5e WHIRLPOOL 8fca5e0c7e120e306f56e2e21438053b688d5363b14569e0e3d8212469a4a17eb21dd9fb910467930b81d0773cac345a348176a61eca788ad388f59755d9e462
 AUX cairo-1.12.18-disable-test-suite.patch 390 SHA256 3ec119ac2380f8565cebbcea4f745e89eeb78686e76e6b15345a76f05812c254 SHA512 097c1a32e007fb6852a0df1ad7f7eab6d00a422247055edf140d3f2b819122b16a9c09e21b9a601766a7facda1961262e68b078944877cab0b3b234eff149783 WHIRLPOOL 5d28d10da94b4d5ea6d90f7eddacf382cfb7307fd312d8029b633cbf5b0cdcaba54148bed100aeab20920974a5bac74fee2b03a7e7893c79360d4ec7f20c13b7
+AUX cairo-1.14.0-CFF-unaligned-access.patch 10097 SHA256 5c9d1756c73c11419ec0eeee13ff1d1eceac7d152cbb213d81fa2a9528d3a31d SHA512 27bf15031b551cbfed36b07d0249b7c58e86e59b5edc203a7e47ff1a44365bbe0761f58a998b3492ed76dcae9a8bb18659f4dd5e3b52f78a69b7dd0926d67758 WHIRLPOOL b45cf550888568016ebbaee30db7d6574a7bc178391b68308c7efec2f07184e82e0c9e19e737ccb2dd07233546bd61e9146191bf7b7c4ae4075554edd06d5a51
 AUX cairo-1.14.0-align-64bit-types.patch 6017 SHA256 9be8ae26ebc6b16f6693156f86d47939223f9a9fd3d4a2aea355a4719a7b6238 SHA512 3ef4af3453a4813f115c565035df3c8e929e85a024c5cf0dc4e04a59dc11a896446b7595e16c874a647904b7b722ec76da3faa3438e4eb153a10123deef7d8c7 WHIRLPOOL 8bee2e77b6967cc3e318a81d25dd6f9e390dff56f0807c5a38102331fb5c95ddf854a40651d9791ac5d0ec32e35c35c55b4188bd7b55c123f705f4bb0ed62b29
+AUX cairo-1.14.0-image-negative-span-length.patch 1155 SHA256 54a78ba4c76c5a843f6cf91b077f628bae8a8ae15b43671a017f6ec19f4ffb3e SHA512 c808e20fc38e0ccc16f35bee189be3f489c888f36734258de343a1855e1c6a6f9f6dc282345e4a6ff69d5d093c639089dfb4f0c9c5e4c0708900b04637d5e661 WHIRLPOOL e6c4d398677698bb3126d90f21f69aae296a39b6cb53092295a73ef70896d4cbf6ef1f45b7c199b882c109ed0d23e5a695618b2b3eee4e1c4bfdfed91fd9eed4
+AUX cairo-1.14.0-tor-scan-converter-do_fullrow-intersection.patch 1236 SHA256 5d93be28cc74b602aed603a236cb27dc313f501172c1fe3b770a5a9b736a8a51 SHA512 7cd37a74cc16b3506913c39422e3dc1847ba3985e6817b65b04065ddf53bd0f94a7f0c1f6914f2d7572d60da423a019e71e934d0c12dadde2af89970e6fe692d WHIRLPOOL 10242fa67df265ed9e813d13cd3969eaae0bf6e67bcba9619d9322a1f7b77dbc38a6597a002e6d44362b2d6759e238fa9bf64b3ecba8abf07a8af7d5ef287029
+AUX cairo-1.14.0-xcb-0-sized-glyph.patch 1346 SHA256 41ed7e8a206b713d251dbc7593eff1b14c6de9e6ddd2f6a89aa747ebd9489233 SHA512 a62a3dd5492fd06044821e3f0cedbc262836483e1938bc1d41fd1865c07635001e306783609cc03571fa1f4c6ba744d5a20f7603e5c175f8ff073ab43e7954ac WHIRLPOOL 66064971bea64c29b1670bd88afcf4bb61cc6b4000aecda6e65f7b9e692a00152ff2020b68ff9f99acac6d06d47651b161e75b16563400b5e6a16cf8f07372f5
+AUX cairo-1.14.0-xlib-0-sized-glyph.patch 1351 SHA256 7cc9651dcca07a801f773bbcfb8b4b0e80aef8516551dff4e4b5184797b99ec5 SHA512 11dff5037647ea9681e20e22e12a362bb871ccbed5ac3bece1a3c6a5c4e003c7704a1aae4e1c7aabdfc0d3eb5226acec8e306d26fa557586c1e1e9c368971944 WHIRLPOOL bab9bf236ceb0cf5e9803375597aae2bb3b6b3ccd9fc23db5d24bbfcade38d785c8243fcc6e9c83d2634119fa540901a75c2532268055ee4c81faff43a110ce8
 AUX cairo-1.8.8-interix.patch 619 SHA256 505be82a1a0b7f963cb49ff85ecf1fa1389a4e43621df76b91fc1529616b2299 SHA512 651b73124ee5b65e2735deefde36727122e9c513da134441be923fb875aedfd3dbd81de8652e3919f3fa04d1de13dee6ec28e4fcd687aaec427d3b0dd94ac703 WHIRLPOOL a1803cbd8f32a8e926a8af932e099c5275920e3e09f7a53ee49898823e81ee7a2533a4db8d2125f200fa409d98fb8e2cbdeb01f00f64b7ba64ba8dffb8487bc3
 AUX cairo-respect-fontconfig.patch 538 SHA256 1732f21adfe5ab291d987b7537b13470266253f599901a4707d27fd2b3d66734 SHA512 4d4d473f956b56f11b31f513de06751dcc77342e0f04ecf37064a74b8217f9d3536c0a8a41b09e580f34576ff2d06815b4cbc2bc091c201f947965509677415e WHIRLPOOL c7d8f364a787b095054507a6dceafe08e8112322853e261303adc07b79a9070be63200dbd4ff465943e2303126bcd7eec51b0f6c53f1d4e9a49fd363acbccde2
 DIST cairo-1.10.2.tar.gz 23558405 SHA256 32018c7998358eebc2ad578ff8d8559d34fc80252095f110a572ed23d989fc41 SHA512 8be4b9ce002f039014d747cc2b48c6a6dfac78df74ebc5ad711a8f36572b819b2c6da3cc4732d0ca93e9052b4b3bb42a146f5e7e346b75dde695d44477b19c9a WHIRLPOOL 8ee0e6f2f520a8e5e046a311926f07a49dd7b730b66b49684ce0ea296b9b5822a80a194b8eff56c73d92da850faa15fed925a1df41b3ea28e3841530548d4ef5
@@ -23,23 +28,26 @@ EBUILD cairo-1.12.16-r4.ebuild 5967 SHA256 5e0b558e4eb8d89d6b05e76762874c3747ab8
 EBUILD cairo-1.12.16.ebuild 4115 SHA256 510a7314d31ee86b1cdc198cc2feae538b577582961b38c1bcab35e8e8da1a17 SHA512 a7964920b7dc9b8fcd3826207fa53046e41d67d3486a73f32cd4183ebf2d9ac500398a0d73604c9d234139344653d66ad8b24eb91e1d48d814c1fa70ba179c29 WHIRLPOOL 1df6b4bae51c564a862e763b0ffb6726ce9ab983bf7fe353e7bfb8f34d32cdd56a2c889efc55d70174061a0b3d8744ef9abb282870e6bae4d119b9331841a40d
 EBUILD cairo-1.12.18-r1.ebuild 5300 SHA256 2a984bb11246e58f2f73a2ecb5eb4b7a5c01b87093895a194be474caf51c9b16 SHA512 b2a2c85b0f784aac2b88f29a7be38bc829c87181681363b7b515f45c0212e34158eb666f954633595e554d727be2d969d2adfcea118e5b32e5f13301a3529040 WHIRLPOOL fb0ee055c9e9fb18ac845fd653e35f710e38589f21f175178632ba38dc8a893a3379e7f7eca32ac9a8c1a5ba1c891cef3c71bf295e4353bd715d36fbc67f773c
 EBUILD cairo-1.14.0-r1.ebuild 5379 SHA256 f7bf0da497a5b006c6873fb6c959dd34716073d4215ff5b000ba77b3b3606860 SHA512 969d81c3ae2161003526630867857935a7dc0e94f3b53254df9533c7baf976d4180c58a94deff8ba508a9db6cd2437af34dd2756624bbd008ab4297e65a69050 WHIRLPOOL 218dd62b2e3e70ed791e372666629d4e223efa411b32980f76e563787afdc60e01d3278eb9f9abd1aa5ee903fd4ecd620a62dbefd93b65d5cc0654a0d25af50a
+EBUILD cairo-1.14.0-r2.ebuild 5755 SHA256 80bf88134e12057ac73c8750b7184053087367345b9484d1fc9914821b458a9d SHA512 7a1f5f7e783e924a3e1b3f7940cdb6602061de8ba76947fd04fabd4df661d541cf31c51d23c1eb22390e9ba7c0bf1ef3b73dfcbb2d145773f69f31993819921c WHIRLPOOL 60d4fe86c1cf6073db11217b8158e138a2a142084b51f3d143865b813713e0ebe3981a3fc27709a16e2a22c2c2eb5ef73676e04111633592b7a736ee1c1e0139
 EBUILD cairo-9999.ebuild 4775 SHA256 4de8533788128e7794f4a46ec34f3d0e978379d2a06790ebc78074c345f81693 SHA512 42ba24bb51ba1c8b088a860d07d1326901d1d1ef9509ae275c03eba08266508574c96e56c02d95d619a80fc6a8506bcb1931a80c0cce29356d028e70a2f17188 WHIRLPOOL eea6de53be6cdcc841c4deae13c74e55b1c792df9586e933cab979efc85407247c40b1267391108cf0015414a6ae73bc83eebce98e27ecc8673c1979a8c8cfc2
-MISC ChangeLog 61343 SHA256 2b6e09bc5071f1289c6d7bdca09d530bba65859b64e7a59c05999f966c03a809 SHA512 d71d5fc5f570492d4753a6d651a9791792da495041beb9ad5562ca788366e34a5d318bb600f6aa7bacd0537e3f9ea0fede71dcef7f866a349786ae36e97023fb WHIRLPOOL ac34295a74ba6795f5ed22bdc6bc77b0039de1ef4b090b08ca46415969d1b2b9ce59f290923b513857cc40b4a2ab90e2e2914bccde7b39d1b3aeacbc2341e3d8
+MISC ChangeLog 61894 SHA256 81da08c5a314bff3f1e9320e6052e8a645d923717f6d8733adfef7cd91e4993e SHA512 7ca187a6c62e15421a012f28464f49a7a19df1f0202abf37f55bc3128c5a1cc9f526890c70ec101a0b6df0b3a2589282731b3cb4f1bae6e94f5196a35cb3ffcc WHIRLPOOL d707102258459344a9b0c9400aa4177b73c79555402575fc40ff2547bf1c8c4c1f377055c747a4a8e98055dcd09723844b77e7befa981d127f48b0e25153212d
 MISC metadata.xml 1294 SHA256 988ed8eceb7738628f10a041a322482997d26a5fed1fd42eb86bd742a6e3602c SHA512 7d333210abf19ed97a1210d37d77a1cbe944220f16757a0c652c1a329d00cc387ebf2ca174db6dc7f79a892ab068c66d773c364da0321fcfeec0a05d84946bcf WHIRLPOOL b0d67117667918643b4d889b74207b995d8fa1c851786fc89bb81cecc5c46e89714533eb2f8cd005e1175ac8c79eb5d3912826e87cf1c34886103b5a4d7e06a2
 -----BEGIN PGP SIGNATURE-----
-Version: GnuPG v2
+Version: GnuPG v2.0
 
-iQIcBAEBCAAGBQJU9Ct0AAoJELp701BxlEWfU6MQAMNg+iB+vs9jxwG6k++pOlwm
-Frg/kho9ZlhlLOsLUGSWcIdCq7PapkCzXnhtHq3xL3jWJxVg0ulWGnmsNnxB1oXj
-kQJB3wH2m/eb/LGarpnL1Q3HSYHMkd6upGEwlZSApNpb4mkJJLkbP9lShhZvGca6
-4RvosYCBSadKxv6Z8/ApBBsLGNUwJQMBn3/r/5leW5igqHbHvUrRup/AeDfyLNLX
-1mIHylECGpNajT9YtQf/XN2KYN5GAu/04rw8pAWydvuPRLZ6iA96nEFtfLJ4g6+E
-D/HdbonXAZYV+CeT8cOJ+lWwajspjMqowgAk0/2Vp3C2srlyA3G1T//fjecvZrJ+
-vYT8lfe9sSzp+hJjXs600yK1kZtj74VMEcZlmhiWjNY0Sq/rmW3x4tLNrv/jwqYn
-eLbVshEMByIBlTY4VVeS4WrHiz5zqm/8LDcNW9D1a6HtIpxoLanQb2+CzcpnoN9e
-CPcBWAxkeP0zuy5BfptWms+rWTqqrYZWMZiFY6m6w7AUj9kcHPxXJQCOZELjkbhy
-v1Mj+l/q9S8Y6gdYg4UAhVLzQv/bkFvF/3M1LsZEWdM09iwi59p5gDsuBJnqdPaE
-5rzL/0rgL7iPxNyYIhIhluKSdb7jYw0vu5MC7QxdWZ3/MzY1Hg0OwXNQmkNHG4jB
-UYrqMoHQ+vGhn3kfwAIj
-=+S51
+iQJ8BAEBCABmBQJU+J8BXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
+ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ1RTNCRkUzRDRBNkI2MEEwQkYwQzMyOEEx
+OEU1QjZGMkQ4RDVFQzhEAAoJEBjltvLY1eyNKvwP/1aokZ3ErhwEPiFkGbE0aO8Y
+W9hCxtXzfFZRS4XWRSL1VRxQY+Ugock4qZ4DxvikEYmqGj1OEn7aPVoR8Afn6On4
+sJduPuMzVbTDY2LtxMCNrTfjgrsrrPd3KV96qECEsEctVmDrtUpgcOf7anCfNfKd
+uJNg+RF9aCvkr21hgPOJ7fsu/sJpCAP4FGUdwzT6Wbz2Cu/NyI4k6yPAMwMdLZJf
+3R5Q6Doswn8vIUN1qNXjcFd/bId9hv14xkRE+OPx+Y2uL4JMvwCrgdQNfxh2Q4Ui
+2M1d66V/bHeWgOzI5Y7aA47MIYGD9JdubGnktSQUsJSvciG4oAJDIXKb531Vr2jU
+nLFI9odLhXhKKU9ZEq+gErVm4d5i7BN3uXH9SdrQ3d1vxZuVWsO4KctiEJNgusTB
+W5MV6QKAVAVxrXO7a0dHfW9fPtnvofL/t7jbinvtv7IaHmNck7PaiObZCgOBbADf
+38aIxc1YJtbo7plvdIJreuFgSOYawvnUaJCsXOkod86e7NvorF9yq+MzoH1741bE
+f118vjlJJcY7/nfSPTJLH9vh4kwFjWVFVJXmWDxW8Yg05gzmOSA9yWTwyV4hUTt5
+CtULjhAI+MVwsTS4ycTxfDlrTRYG3ZMstWw8kjDln8G9EiFC5vY+jYiRYV6ykAv/
+sXCNACOrti+PRwCHNnu8
+=+fsr
 -----END PGP SIGNATURE-----
diff --git a/x11-libs/cairo/cairo-1.14.0-r2.ebuild b/x11-libs/cairo/cairo-1.14.0-r2.ebuild
new file mode 100644 (file)
index 0000000..e7a40cf
--- /dev/null
@@ -0,0 +1,184 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-libs/cairo/cairo-1.14.0-r2.ebuild,v 1.1 2015/03/05 18:22:53 tetromino Exp $
+
+EAPI=5
+
+inherit eutils flag-o-matic autotools multilib-minimal
+
+if [[ ${PV} == *9999* ]]; then
+       inherit git-2
+       EGIT_REPO_URI="git://anongit.freedesktop.org/git/cairo"
+       SRC_URI=""
+else
+       SRC_URI="http://cairographics.org/releases/${P}.tar.xz"
+       KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~x86-interix ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+
+DESCRIPTION="A vector graphics library with cross-device output support"
+HOMEPAGE="http://cairographics.org/"
+LICENSE="|| ( LGPL-2.1 MPL-1.1 )"
+SLOT="0"
+IUSE="X aqua debug directfb drm gallium gles2 +glib opengl openvg qt4 static-libs +svg valgrind xcb xlib-xcb"
+# gtk-doc regeneration doesn't seem to work with out-of-source builds
+#[[ ${PV} == *9999* ]] && IUSE="${IUSE} doc" # API docs are provided in tarball, no need to regenerate
+
+# Test causes a circular depend on gtk+... since gtk+ needs cairo but test needs gtk+ so we need to block it
+RESTRICT="test"
+
+RDEPEND=">=dev-libs/lzo-2.06-r1[${MULTILIB_USEDEP}]
+       >=media-libs/fontconfig-2.10.92[${MULTILIB_USEDEP}]
+       >=media-libs/freetype-2.5.0.1:2[${MULTILIB_USEDEP}]
+       >=media-libs/libpng-1.6.10:0=[${MULTILIB_USEDEP}]
+       >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}]
+       >=x11-libs/pixman-0.32.4[${MULTILIB_USEDEP}]
+       directfb? ( dev-libs/DirectFB )
+       gles2? ( >=media-libs/mesa-9.1.6[gles2,${MULTILIB_USEDEP}] )
+       glib? ( >=dev-libs/glib-2.34.3:2[${MULTILIB_USEDEP}] )
+       opengl? ( || ( >=media-libs/mesa-9.1.6[egl,${MULTILIB_USEDEP}] media-libs/opengl-apple ) )
+       openvg? ( >=media-libs/mesa-9.1.6[openvg,${MULTILIB_USEDEP}] )
+       qt4? ( >=dev-qt/qtgui-4.8:4[${MULTILIB_USEDEP}] )
+       X? (
+               >=x11-libs/libXrender-0.9.8[${MULTILIB_USEDEP}]
+               >=x11-libs/libXext-1.3.2[${MULTILIB_USEDEP}]
+               >=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}]
+               drm? (
+                       >=virtual/libudev-208:=[${MULTILIB_USEDEP}]
+                       gallium? ( >=media-libs/mesa-9.1.6[gallium,${MULTILIB_USEDEP}] )
+               )
+       )
+       xcb? (
+               >=x11-libs/libxcb-1.9.1[${MULTILIB_USEDEP}]
+       )
+       abi_x86_32? (
+               !<=app-emulation/emul-linux-x86-gtklibs-20131008-r1
+               !app-emulation/emul-linux-x86-gtklibs[-abi_x86_32(-)]
+       )"
+DEPEND="${RDEPEND}
+       virtual/pkgconfig
+       >=sys-devel/libtool-2
+       X? (
+               >=x11-proto/renderproto-0.11.1-r1[${MULTILIB_USEDEP}]
+               drm? (
+                       >=x11-proto/xproto-7.0.24[${MULTILIB_USEDEP}]
+                       >=x11-proto/xextproto-7.2.1-r1[${MULTILIB_USEDEP}]
+               )
+       )"
+#[[ ${PV} == *9999* ]] && DEPEND="${DEPEND}
+#      doc? (
+#              >=dev-util/gtk-doc-1.6
+#              ~app-text/docbook-xml-dtd-4.2
+#      )"
+
+# drm module requires X
+# for gallium we need to enable drm
+REQUIRED_USE="
+       drm? ( X )
+       gallium? ( drm )
+       gles2? ( !opengl )
+       openvg? ( || ( gles2 opengl ) )
+       xlib-xcb? ( xcb )
+"
+
+MULTILIB_WRAPPED_HEADERS=(
+       /usr/include/cairo/cairo-directfb.h
+)
+
+src_prepare() {
+       epatch "${FILESDIR}"/${PN}-1.12.18-disable-test-suite.patch
+       epatch "${FILESDIR}"/${PN}-respect-fontconfig.patch
+
+       # fixed in 1.14 branch
+       epatch "${FILESDIR}"/${P}-align-64bit-types.patch
+
+       # fixed in master branch
+       epatch "${FILESDIR}"/${PN}-1.14.0-CFF-unaligned-access.patch
+       epatch "${FILESDIR}"/${PN}-1.14.0-tor-scan-converter-do_fullrow-intersection.patch #541326
+       epatch "${FILESDIR}"/${PN}-1.14.0-xlib-0-sized-glyph.patch
+       epatch "${FILESDIR}"/${PN}-1.14.0-xcb-0-sized-glyph.patch
+       epatch "${FILESDIR}"/${PN}-1.14.0-image-negative-span-length.patch
+
+       # tests and perf tools require X, bug #483574
+       if ! use X; then
+               sed -e '/^SUBDIRS/ s#boilerplate test perf# #' -i Makefile.am || die
+       fi
+
+       epatch_user
+
+       # Slightly messed build system YAY
+       if [[ ${PV} == *9999* ]]; then
+               touch boilerplate/Makefile.am.features
+               touch src/Makefile.am.features
+               touch ChangeLog
+       fi
+
+       eautoreconf
+}
+
+multilib_src_configure() {
+       local myopts
+
+       [[ ${CHOST} == *-interix* ]] && append-flags -D_REENTRANT
+
+       use elibc_FreeBSD && myopts+=" --disable-symbol-lookup"
+
+       # TODO: remove this (and add USE-dep) when DirectFB is converted,
+       # bug #484248 -- but beware of the circular dep.
+       if ! multilib_is_native_abi; then
+               myopts+=" --disable-directfb"
+       fi
+
+       # TODO: remove this (and add USE-dep) when qtgui is converted, bug #498010
+       if ! multilib_is_native_abi; then
+               myopts+=" --disable-qt"
+       fi
+
+       # [[ ${PV} == *9999* ]] && myopts+=" $(use_enable doc gtk-doc)"
+
+       ECONF_SOURCE="${S}" \
+       econf \
+               --disable-dependency-tracking \
+               $(use_with X x) \
+               $(use_enable X tee) \
+               $(use_enable X xlib) \
+               $(use_enable X xlib-xrender) \
+               $(use_enable aqua quartz) \
+               $(use_enable aqua quartz-image) \
+               $(use_enable debug test-surfaces) \
+               $(use_enable drm) \
+               $(use_enable directfb) \
+               $(use_enable gallium) \
+               $(use_enable gles2 glesv2) \
+               $(use_enable glib gobject) \
+               $(use_enable openvg vg) \
+               $(use_enable opengl gl) \
+               $(use_enable qt4 qt) \
+               $(use_enable static-libs static) \
+               $(use_enable svg) \
+               $(use_enable valgrind) \
+               $(use_enable xcb) \
+               $(use_enable xcb xcb-shm) \
+               $(use_enable xlib-xcb) \
+               --enable-ft \
+               --enable-pdf \
+               --enable-png \
+               --enable-ps \
+               ${myopts}
+}
+
+multilib_src_install_all() {
+       prune_libtool_files --all
+       einstalldocs
+}
+
+pkg_postinst() {
+       if use !xlib-xcb; then
+               if has_version net-misc/nxserver-freenx \
+                               || has_version net-misc/x2goserver; then
+                       ewarn "cairo-1.12 is known to cause GTK+ errors with NX servers."
+                       ewarn "Enable USE=\"xlib-xcb\" if you notice incorrect behavior in GTK+"
+                       ewarn "applications that are running inside NX sessions. For details, see"
+                       ewarn "https://bugs.gentoo.org/441878 or https://bugs.freedesktop.org/59173"
+               fi
+       fi
+}
diff --git a/x11-libs/cairo/files/cairo-1.14.0-CFF-unaligned-access.patch b/x11-libs/cairo/files/cairo-1.14.0-CFF-unaligned-access.patch
new file mode 100644 (file)
index 0000000..9fd1ebb
--- /dev/null
@@ -0,0 +1,282 @@
+From 99a35dd273f3deb4ae54310f1ed1746bfd9fae70 Mon Sep 17 00:00:00 2001
+From: Adrian Johnson <ajohnson@redneon.com>
+Date: Sun, 19 Oct 2014 11:34:34 +1030
+Subject: [PATCH] CFF: Fix unaligned access
+
+Debian bug 712836 reported bus errors in cff subsetting when
+running on a sparc. This is because unlike truetype, all data
+in the compact font format is not aligned.
+
+https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=712836
+---
+ src/cairo-cff-subset.c | 35 +++++++++++++++++++----------------
+ src/cairo-image-info.c | 32 +++++++++++++-------------------
+ src/cairoint.h         | 26 ++++++++++++++++++++++++++
+ 3 files changed, 58 insertions(+), 35 deletions(-)
+
+diff --git a/src/cairo-cff-subset.c b/src/cairo-cff-subset.c
+index 4660d6e..f15deb5 100644
+--- a/src/cairo-cff-subset.c
++++ b/src/cairo-cff-subset.c
+@@ -433,7 +433,7 @@ cff_index_read (cairo_array_t *index, unsigned char **ptr, unsigned char *end_pt
+     p = *ptr;
+     if (p + 2 > end_ptr)
+         return CAIRO_INT_STATUS_UNSUPPORTED;
+-    count = be16_to_cpu( *((uint16_t *)p) );
++    count = get_unaligned_be16 (p);
+     p += 2;
+     if (count > 0) {
+         offset_size = *p++;
+@@ -984,14 +984,14 @@ cairo_cff_font_read_fdselect (cairo_cff_font_t *font, unsigned char *p)
+         for (i = 0; i < font->num_glyphs; i++)
+             font->fdselect[i] = *p++;
+     } else if (type == 3) {
+-        num_ranges = be16_to_cpu( *((uint16_t *)p) );
++        num_ranges = get_unaligned_be16 (p);
+         p += 2;
+         for  (i = 0; i < num_ranges; i++)
+         {
+-            first = be16_to_cpu( *((uint16_t *)p) );
++            first = get_unaligned_be16 (p);
+             p += 2;
+             fd = *p++;
+-            last = be16_to_cpu( *((uint16_t *)p) );
++            last = get_unaligned_be16 (p);
+             for (j = first; j < last; j++)
+                 font->fdselect[j] = fd;
+         }
+@@ -1722,7 +1722,7 @@ cairo_cff_font_get_gid_for_cid (cairo_cff_font_t  *font, unsigned long cid, unsi
+           p = font->charset + 1;
+           g = 1;
+           while (g <= (unsigned)font->num_glyphs && p < font->data_end) {
+-              c = be16_to_cpu( *((uint16_t *)p) );
++              c = get_unaligned_be16 (p);
+               if (c == cid) {
+                   *gid = g;
+                   return CAIRO_STATUS_SUCCESS;
+@@ -1737,7 +1737,7 @@ cairo_cff_font_get_gid_for_cid (cairo_cff_font_t  *font, unsigned long cid, unsi
+           first_gid = 1;
+           p = font->charset + 1;
+           while (first_gid <= (unsigned)font->num_glyphs && p + 2 < font->data_end) {
+-              first_cid = be16_to_cpu( *((uint16_t *)p) );
++              first_cid = get_unaligned_be16 (p);
+               num_left = p[2];
+               if (cid >= first_cid && cid <= first_cid + num_left) {
+                   *gid = first_gid + cid - first_cid;
+@@ -1753,8 +1753,8 @@ cairo_cff_font_get_gid_for_cid (cairo_cff_font_t  *font, unsigned long cid, unsi
+           first_gid = 1;
+           p = font->charset + 1;
+           while (first_gid <= (unsigned)font->num_glyphs && p + 3 < font->data_end) {
+-              first_cid = be16_to_cpu( *((uint16_t *)p) );
+-              num_left = be16_to_cpu( *((uint16_t *)(p+2)) );
++              first_cid = get_unaligned_be16 (p);
++              num_left = get_unaligned_be16 (p+2);
+               if (cid >= first_cid && cid <= first_cid + num_left) {
+                   *gid = first_gid + cid - first_cid;
+                   return CAIRO_STATUS_SUCCESS;
+@@ -2328,7 +2328,7 @@ cairo_cff_font_write_cid_fontdict (cairo_cff_font_t *font)
+     unsigned int i;
+     cairo_int_status_t status;
+     unsigned int offset_array;
+-    uint32_t *offset_array_ptr;
++    unsigned char *offset_array_ptr;
+     int offset_base;
+     uint16_t count;
+     uint8_t offset_size = 4;
+@@ -2349,7 +2349,7 @@ cairo_cff_font_write_cid_fontdict (cairo_cff_font_t *font)
+     if (unlikely (status))
+         return status;
+     offset_base = _cairo_array_num_elements (&font->output) - 1;
+-    *offset_array_ptr = cpu_to_be32(1);
++    put_unaligned_be32(1, offset_array_ptr);
+     offset_array += sizeof(uint32_t);
+     for (i = 0; i < font->num_subset_fontdicts; i++) {
+         status = cff_dict_write (font->fd_dict[font->fd_subset_map[i]],
+@@ -2357,8 +2357,9 @@ cairo_cff_font_write_cid_fontdict (cairo_cff_font_t *font)
+         if (unlikely (status))
+             return status;
+ 
+-      offset_array_ptr = (uint32_t *) _cairo_array_index (&font->output, offset_array);
+-        *offset_array_ptr = cpu_to_be32(_cairo_array_num_elements (&font->output) - offset_base);
++      offset_array_ptr = _cairo_array_index (&font->output, offset_array);
++      put_unaligned_be32 (_cairo_array_num_elements (&font->output) - offset_base,
++                          offset_array_ptr);
+       offset_array += sizeof(uint32_t);
+     }
+ 
+@@ -2609,7 +2610,7 @@ cairo_cff_font_create_set_widths (cairo_cff_font_t *font)
+     unsigned int i;
+     tt_hhea_t hhea;
+     int num_hmetrics;
+-    unsigned char buf[10];
++    uint16_t short_entry;
+     int glyph_index;
+     cairo_int_status_t status;
+ 
+@@ -2629,7 +2630,8 @@ cairo_cff_font_create_set_widths (cairo_cff_font_t *font)
+             status = font->backend->load_truetype_table (font->scaled_font_subset->scaled_font,
+                                                          TT_TAG_hmtx,
+                                                          glyph_index * long_entry_size,
+-                                                         buf, &short_entry_size);
++                                                         (unsigned char *) &short_entry,
++                                                       &short_entry_size);
+             if (unlikely (status))
+                 return status;
+         }
+@@ -2638,11 +2640,12 @@ cairo_cff_font_create_set_widths (cairo_cff_font_t *font)
+             status = font->backend->load_truetype_table (font->scaled_font_subset->scaled_font,
+                                                          TT_TAG_hmtx,
+                                                          (num_hmetrics - 1) * long_entry_size,
+-                                                         buf, &short_entry_size);
++                                                         (unsigned char *) &short_entry,
++                                                       &short_entry_size);
+             if (unlikely (status))
+                 return status;
+         }
+-        font->widths[i] = be16_to_cpu (*((int16_t*)buf));
++      font->widths[i] = be16_to_cpu (short_entry);
+     }
+ 
+     return CAIRO_STATUS_SUCCESS;
+diff --git a/src/cairo-image-info.c b/src/cairo-image-info.c
+index 64053a2..26e7ae5 100644
+--- a/src/cairo-image-info.c
++++ b/src/cairo-image-info.c
+@@ -39,12 +39,6 @@
+ #include "cairo-error-private.h"
+ #include "cairo-image-info-private.h"
+ 
+-static uint32_t
+-_get_be32 (const unsigned char *p)
+-{
+-    return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3];
+-}
+-
+ /* JPEG (image/jpeg)
+  *
+  * http://www.w3.org/Graphics/JPEG/itu-t81.pdf
+@@ -170,7 +164,7 @@ static const unsigned char _jpx_signature[] = {
+ static const unsigned char *
+ _jpx_next_box (const unsigned char *p)
+ {
+-    return p + _get_be32 (p);
++    return p + get_unaligned_be32 (p);
+ }
+ 
+ static const unsigned char *
+@@ -185,8 +179,8 @@ _jpx_match_box (const unsigned char *p, const unsigned char *end, uint32_t type)
+     uint32_t length;
+ 
+     if (p + 8 < end) {
+-      length = _get_be32 (p);
+-      if (_get_be32 (p + 4) == type &&  p + length < end)
++      length = get_unaligned_be32 (p);
++      if (get_unaligned_be32 (p + 4) == type &&  p + length < end)
+           return TRUE;
+     }
+ 
+@@ -208,8 +202,8 @@ _jpx_find_box (const unsigned char *p, const unsigned char *end, uint32_t type)
+ static void
+ _jpx_extract_info (const unsigned char *p, cairo_image_info_t *info)
+ {
+-    info->height = _get_be32 (p);
+-    info->width = _get_be32 (p + 4);
++    info->height = get_unaligned_be32 (p);
++    info->width = get_unaligned_be32 (p + 4);
+     info->num_components = (p[8] << 8) + p[9];
+     info->bits_per_component = p[10];
+ }
+@@ -281,13 +275,13 @@ _cairo_image_info_get_png_info (cairo_image_info_t     *info,
+        return CAIRO_INT_STATUS_UNSUPPORTED;
+ 
+     p += 4;
+-    if (_get_be32 (p) != PNG_IHDR)
++    if (get_unaligned_be32 (p) != PNG_IHDR)
+        return CAIRO_INT_STATUS_UNSUPPORTED;
+ 
+     p += 4;
+-    info->width = _get_be32 (p);
++    info->width = get_unaligned_be32 (p);
+     p += 4;
+-    info->height = _get_be32 (p);
++    info->height = get_unaligned_be32 (p);
+ 
+     return CAIRO_STATUS_SUCCESS;
+ }
+@@ -347,14 +341,14 @@ _jbig2_get_next_segment (const unsigned char  *p,
+     if (p + 6 >= end)
+       return NULL;
+ 
+-    seg_num = _get_be32 (p);
++    seg_num = get_unaligned_be32 (p);
+     *type = p[4] & 0x3f;
+     big_page_size = (p[4] & 0x40) != 0;
+     p += 5;
+ 
+     num_segs = p[0] >> 5;
+     if (num_segs == 7) {
+-      num_segs = _get_be32 (p) & 0x1fffffff;
++      num_segs = get_unaligned_be32 (p) & 0x1fffffff;
+       ref_seg_bytes = 4 + ((num_segs + 1)/8);
+     } else {
+       ref_seg_bytes = 1;
+@@ -373,7 +367,7 @@ _jbig2_get_next_segment (const unsigned char  *p,
+     if (p + 4 >= end)
+       return NULL;
+ 
+-    *data_len = _get_be32 (p);
++    *data_len = get_unaligned_be32 (p);
+     p += 4;
+     *data = p;
+ 
+@@ -397,8 +391,8 @@ _jbig2_get_next_segment (const unsigned char  *p,
+ static void
+ _jbig2_extract_info (cairo_image_info_t *info, const unsigned char *p)
+ {
+-    info->width = _get_be32 (p);
+-    info->height = _get_be32 (p + 4);
++    info->width = get_unaligned_be32 (p);
++    info->height = get_unaligned_be32 (p + 4);
+     info->num_components = 1;
+     info->bits_per_component = 1;
+ }
+diff --git a/src/cairoint.h b/src/cairoint.h
+index b4e8ac8..07ced42 100644
+--- a/src/cairoint.h
++++ b/src/cairoint.h
+@@ -240,6 +240,32 @@ be32_to_cpu(uint32_t v)
+ 
+ #endif
+ 
++/* Unaligned big endian access
++ */
++
++static inline uint16_t get_unaligned_be16 (const unsigned char *p)
++{
++    return p[0] << 8 | p[1];
++}
++
++static inline uint32_t get_unaligned_be32 (const unsigned char *p)
++{
++    return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3];
++}
++
++static inline void put_unaligned_be16 (uint16_t v, unsigned char *p)
++{
++    p[0] = (v >> 8) & 0xff;
++    p[1] = v & 0xff;
++}
++
++static inline void put_unaligned_be32 (uint32_t v, unsigned char *p)
++{
++    p[0] = (v >> 24) & 0xff;
++    p[1] = (v >> 16) & 0xff;
++    p[2] = (v >> 8)  & 0xff;
++    p[3] = v & 0xff;
++}
+ 
+ /* The glibc versions of ispace() and isdigit() are slow in UTF-8 locales.
+  */
+-- 
+2.3.1
+
diff --git a/x11-libs/cairo/files/cairo-1.14.0-image-negative-span-length.patch b/x11-libs/cairo/files/cairo-1.14.0-image-negative-span-length.patch
new file mode 100644 (file)
index 0000000..d3edb74
--- /dev/null
@@ -0,0 +1,35 @@
+From 5c82d91a5e15d29b1489dcb413b24ee7fdf59934 Mon Sep 17 00:00:00 2001
+From: Bryce Harrington <bryce@osg.samsung.com>
+Date: Wed, 3 Dec 2014 19:28:15 -0800
+Subject: [PATCH] image: Fix crash in _fill_xrgb32_lerp_opaque_spans
+
+If a span length is negative don't go out of bounds processing the fill
+data.
+
+Patch thanks to Ilya Sakhnenko <ilia.softway@gmail.com> on mailing list.
+
+Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
+---
+ src/cairo-image-compositor.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/cairo-image-compositor.c b/src/cairo-image-compositor.c
+index 6ff0f09..48072f8 100644
+--- a/src/cairo-image-compositor.c
++++ b/src/cairo-image-compositor.c
+@@ -2242,10 +2242,10 @@ _fill_xrgb32_lerp_opaque_spans (void *abstract_renderer, int y, int h,
+                                    spans[0].x, y, len, 1, r->u.fill.pixel);
+                   } else {
+                       uint32_t *d = (uint32_t*)(r->u.fill.data + r->u.fill.stride*y + spans[0].x*4);
+-                      while (len--)
++                      while (len-- > 0)
+                           *d++ = r->u.fill.pixel;
+                   }
+-              } else while (len--) {
++              } else while (len-- > 0) {
+                   *d = lerp8x4 (r->u.fill.pixel, a, *d);
+                   d++;
+               }
+-- 
+2.3.1
+
diff --git a/x11-libs/cairo/files/cairo-1.14.0-tor-scan-converter-do_fullrow-intersection.patch b/x11-libs/cairo/files/cairo-1.14.0-tor-scan-converter-do_fullrow-intersection.patch
new file mode 100644 (file)
index 0000000..f8e67e5
--- /dev/null
@@ -0,0 +1,36 @@
+From 2de69581c28bf115852037ca41eba13cb7335976 Mon Sep 17 00:00:00 2001
+From: Massimo Valentini <mvalentini@src.gnome.org>
+Date: Sun, 19 Oct 2014 09:19:10 +0200
+Subject: [PATCH] tor-scan-converter: can't do_fullrow when intersection in row
+ + 0.5subrow
+
+the active edges list must be left sorted at the next possible use
+and since full_row does not deal with intersections it is not usable
+when there is an intersection in the top half of the next row first
+subrow
+
+Reported-and-tested-by: Matthew Leach
+Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85151
+Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
+---
+ src/cairo-tor-scan-converter.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/cairo-tor-scan-converter.c b/src/cairo-tor-scan-converter.c
+index 4adcafb..14922d0 100644
+--- a/src/cairo-tor-scan-converter.c
++++ b/src/cairo-tor-scan-converter.c
+@@ -1167,8 +1167,8 @@ can_do_full_row (struct active_list *active)
+ 
+       if (e->dy) {
+           struct quorem x = e->x;
+-          x.quo += e->dxdy_full.quo - e->dxdy.quo/2;
+-          x.rem += e->dxdy_full.rem - e->dxdy.rem/2;
++          x.quo += e->dxdy_full.quo;
++          x.rem += e->dxdy_full.rem;
+           if (x.rem < 0) {
+               x.quo--;
+               x.rem += e->dy;
+-- 
+2.3.1
+
diff --git a/x11-libs/cairo/files/cairo-1.14.0-xcb-0-sized-glyph.patch b/x11-libs/cairo/files/cairo-1.14.0-xcb-0-sized-glyph.patch
new file mode 100644 (file)
index 0000000..8e85395
--- /dev/null
@@ -0,0 +1,43 @@
+From a03f2ff72054c9530f98738aac729354a3f56102 Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax@redhat.com>
+Date: Fri, 31 Oct 2014 13:21:15 -0400
+Subject: [PATCH 2/2] xcb: Don't crash when swapping a 0-sized glyph
+
+malloc(0) needn't return NULL, and on glibc, doesn't.  Then we encounter
+a loop of the form do { ... } while (--c), which doesn't do quite what
+you were hoping for when c is initially 0.
+
+Since there's nothing to swap in this case, just bomb out.
+
+Signed-off-by: Adam Jackson <ajax@redhat.com>
+---
+ src/cairo-xcb-surface-render.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c
+index 21a89cc..1a086a2 100644
+--- a/src/cairo-xcb-surface-render.c
++++ b/src/cairo-xcb-surface-render.c
+@@ -4467,6 +4467,9 @@ _cairo_xcb_surface_add_glyph (cairo_xcb_connection_t *connection,
+           const uint8_t *d;
+           uint8_t *new, *n;
+ 
++          if (c == 0)
++              break;
++
+           new = malloc (c);
+           if (unlikely (new == NULL)) {
+               status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
+@@ -4495,6 +4498,9 @@ _cairo_xcb_surface_add_glyph (cairo_xcb_connection_t *connection,
+           const uint32_t *d;
+           uint32_t *new, *n;
+ 
++          if (c == 0)
++              break;
++
+           new = malloc (4 * c);
+           if (unlikely (new == NULL)) {
+               status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
+-- 
+2.3.1
+
diff --git a/x11-libs/cairo/files/cairo-1.14.0-xlib-0-sized-glyph.patch b/x11-libs/cairo/files/cairo-1.14.0-xlib-0-sized-glyph.patch
new file mode 100644 (file)
index 0000000..c8e4084
--- /dev/null
@@ -0,0 +1,43 @@
+From 3cf862f6d973755cd9824c2224fbe0a623c47ff1 Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax@redhat.com>
+Date: Fri, 31 Oct 2014 13:21:14 -0400
+Subject: [PATCH 1/2] xlib: Don't crash when swapping a 0-sized glyph
+
+malloc(0) needn't return NULL, and on glibc, doesn't.  Then we encounter
+a loop of the form do { ... } while (--c), which doesn't do quite what
+you were hoping for when c is initially 0.
+
+Since there's nothing to swap in this case, just bomb out.
+
+Signed-off-by: Adam Jackson <ajax@redhat.com>
+---
+ src/cairo-xlib-render-compositor.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/src/cairo-xlib-render-compositor.c b/src/cairo-xlib-render-compositor.c
+index e90df09..8a1ec7b 100644
+--- a/src/cairo-xlib-render-compositor.c
++++ b/src/cairo-xlib-render-compositor.c
+@@ -1287,6 +1287,9 @@ _cairo_xlib_surface_add_glyph (cairo_xlib_display_t *display,
+           unsigned char   *d;
+           unsigned char   *new, *n;
+ 
++          if (c == 0)
++              break;
++
+           new = malloc (c);
+           if (!new) {
+               status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
+@@ -1312,6 +1315,9 @@ _cairo_xlib_surface_add_glyph (cairo_xlib_display_t *display,
+           const uint32_t *d;
+           uint32_t *new, *n;
+ 
++          if (c == 0)
++              break;
++
+           new = malloc (4 * c);
+           if (unlikely (new == NULL)) {
+               status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
+-- 
+2.3.1
+