[cairo-commit] 9 commits - build/aclocal.float.m4 src/cairo-clip-inline.h test/cairo-test-runner.c test/Makefile.am test/Makefile.sources

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 20 16:35:24 UTC 2020


 build/aclocal.float.m4   |    7 +++++--
 src/cairo-clip-inline.h  |   17 +++++++++++++++--
 test/Makefile.am         |    3 ++-
 test/Makefile.sources    |    4 +++-
 test/cairo-test-runner.c |    2 +-
 5 files changed, 26 insertions(+), 7 deletions(-)

New commits:
commit b55e491d67e95d7e6ef33f18a239eb6a9a49b7a2
Merge: 4777f9cd5 61cd11a39
Author: Uli Schlachter <psychon at znc.in>
Date:   Mon Jul 20 18:33:46 2020 +0200

    Merge branch 'invalid-free-crash' of gitlab.freedesktop.org:psychon/cairo

commit 4777f9cd5f67dcab6e750092630aaace8607c4b5
Merge: e0f9db945 c93ca40f6
Author: Uli Schlachter <psychon at znc.in>
Date:   Mon Jul 20 18:32:33 2020 +0200

    Merge branch 'fix-build-rule-for-font-variations' of gitlab.freedesktop.org:mpsuzuki/cairo

commit e0f9db9459b2eee16507bd8cc06ef668f14291db
Merge: bf1219919 cb2357f48
Author: Uli Schlachter <psychon at znc.in>
Date:   Mon Jul 20 18:30:45 2020 +0200

    Merge branch 'master' of gitlab.freedesktop.org:ffontaine/cairo

commit bf121991964b10ea06ca8c991bead5857509ce5a
Merge: c4fd00c2c 23b6e8bb5
Author: Uli Schlachter <psychon at znc.in>
Date:   Mon Jul 20 18:29:39 2020 +0200

    Merge branch 'master' of gitlab.freedesktop.org:trofi/cairo

commit 23b6e8bb5798c77550da613fadc3da8b3be14573
Author: Sergei Trofimovich <slyfox at gentoo.org>
Date:   Sun Jun 14 09:58:52 2020 +0100

    build/aclocal.float.m4: detect 'strings' with AC_CHECK_TOOL
    
    This way all binutils tools are detected with $CHOST prefix
    if exist. And strings is allowed to be substituted with
    STRINGS environment override, so 'llvm-strings' (or other)
    alternative can be used.
    
    Bug: https://bugs.gentoo.org/726200
    Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>

diff --git a/build/aclocal.float.m4 b/build/aclocal.float.m4
index f92db03e6..d9728c123 100644
--- a/build/aclocal.float.m4
+++ b/build/aclocal.float.m4
@@ -31,10 +31,13 @@ int main() { return 0; }
 
 ]])], [
 
-if strings -a conftest$ac_exeext | grep noonsees >/dev/null ; then
+# allow users to override default 'strings' with 'llvm-strings'
+# or ${CHOST}-strings.
+AC_CHECK_TOOL(STRINGS, strings)
+if $STRINGS -a conftest$ac_exeext | grep noonsees >/dev/null ; then
   ax_cv_c_float_words_bigendian=yes
 fi
-if strings -a conftest$ac_exeext | grep seesnoon >/dev/null ; then
+if $STRINGS -a conftest$ac_exeext | grep seesnoon >/dev/null ; then
   if test "$ax_cv_c_float_words_bigendian" = unknown; then
     ax_cv_c_float_words_bigendian=no
   else
commit cb2357f481396820ec954dc4b69eafc01a8d162a
Author: Fabrice Fontaine <fontaine.fabrice at gmail.com>
Date:   Mon Feb 3 21:24:25 2020 +0100

    test: fix build when SHOULD_FORK is false
    
    The code in test/cairo-test-runner.c properly takes into account
    platforms that do have fork() support, and uses the SHOULD_FORK define
    to know whether fork is available or not.
    
    However, this SHOULD_FORK macro is used to guard the inclusion of
    <unistd.h>, which is needed to get the prototype of other functions
    (namely readlink and getppid), that are used in portions of this file
    not guarded by SHOULD_FORK.
    
    Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
    [Retrieved from:
    https://git.buildroot.net/buildroot/tree/package/cairo/0001-fix-nofork-build.patch]
    Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>

diff --git a/test/cairo-test-runner.c b/test/cairo-test-runner.c
index f9e7d4712..b1f77b358 100644
--- a/test/cairo-test-runner.c
+++ b/test/cairo-test-runner.c
@@ -36,10 +36,10 @@
 #include <pixman.h> /* for version information */
 
 #define SHOULD_FORK HAVE_FORK && HAVE_WAITPID
-#if SHOULD_FORK
 #if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#if SHOULD_FORK
 #if HAVE_SIGNAL_H
 #include <signal.h>
 #endif
commit c93ca40f60bc839c0193a572e97ec2d297190c95
Author: suzuki toshiya <mpsuzuki at hiroshima-u.ac.jp>
Date:   Wed Apr 10 01:07:16 2019 +0000

    regrouping of test sources with new 'fc_font_test_sources' group

diff --git a/test/Makefile.am b/test/Makefile.am
index d69012b65..8e271fe9b 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -11,8 +11,9 @@ test_sources += $(pthread_test_sources)
 endif
 
 if CAIRO_HAS_FT_FONT
-if CAIRO_HAS_FC_FONT
 test_sources += $(ft_font_test_sources)
+if CAIRO_HAS_FC_FONT
+test_sources += $(fc_font_test_sources)
 endif
 endif
 
diff --git a/test/Makefile.sources b/test/Makefile.sources
index cc3d81f7e..cb1c74d53 100644
--- a/test/Makefile.sources
+++ b/test/Makefile.sources
@@ -397,8 +397,10 @@ pthread_test_sources =					\
 	$(NULL)
 
 ft_font_test_sources = \
+	font-variations.c
+
+fc_font_test_sources = \
 	bitmap-font.c \
-	font-variations.c \
 	ft-font-create-for-ft-face.c \
 	ft-show-glyphs-positioning.c \
 	ft-show-glyphs-table.c \
commit d331c69f65477b01859862f783081352f318c6d2
Author: suzuki toshiya <mpsuzuki at hiroshima-u.ac.jp>
Date:   Mon Apr 8 02:56:50 2019 +0000

    Makefile.sources: move font-variations.c (a test code for
    Variation Font with FreeType2 functions) from test_sources
    to ft_font_test_sources, to restrict the test to the case
    with FreeType2 backend. See discussion in
    https://lists.cairographics.org/archives/cairo/2019-April/028858.html

diff --git a/test/Makefile.sources b/test/Makefile.sources
index c47131faf..cc3d81f7e 100644
--- a/test/Makefile.sources
+++ b/test/Makefile.sources
@@ -144,7 +144,6 @@ test_sources = \
 	font-face-get-type.c				\
 	font-matrix-translation.c			\
 	font-options.c					\
-	font-variations.c				\
 	glyph-cache-pressure.c				\
 	get-and-set.c					\
 	get-clip.c					\
@@ -399,6 +398,7 @@ pthread_test_sources =					\
 
 ft_font_test_sources = \
 	bitmap-font.c \
+	font-variations.c \
 	ft-font-create-for-ft-face.c \
 	ft-show-glyphs-positioning.c \
 	ft-show-glyphs-table.c \
commit 61cd11a39095cb51b9e87beba10905e895567151
Author: Uli Schlachter <psychon at znc.in>
Date:   Tue Feb 12 17:46:12 2019 +0100

    steal boxes: Fix an invalif free() exposed by cb871c6c
    
    Commits cb871c6c made the function _cairo_clip_reduce_to_boxes()
    actually do something instead of being a no-op. This exposed a latent
    bug in cairo that was so far just not hit due to luck.
    
    The function _cairo_clip_steal_boxes() removes the boxes from a clip and
    gives them to a cairo_boxes_t. _cairo_clip_unsteal_boxes() undoes this
    operation. For efficiency reasons, cairo_clip_t contains an embedded
    cairo_box_t that is used when the clip has only one box to avoid a
    memory allocation. Thus, _cairo_clip_unsteal_boxes() must be called on
    the same clip that was given to _cairo_clip_steal_boxes(), or otherwise
    a clip could end up to the embedded box of another instance of
    cairo_clip_t. This is exactly what was happening here.
    
    For example, cairo-xcb can replace extents->clip with another clip via
    the call chain _cairo_xcb_render_compositor_paint() (which is where
    boxes are stolen) -> _clip_and_composite_boxes() ->
    trim_extents_to_traps() ->
    _cairo_composite_rectangles_intersect_mask_extents(). This function
    replaced the clip with the result of _cairo_clip_reduce_for_composite()
    and frees the old clip. At this point, the boxes that were stolen
    previously become invalid / become a dangling pointer. The crash later
    on is just one of the side effects of this.
    
    This commit fixes this problem by treating embedded boxes specially in
    _cairo_clip_steal_boxes() and _cairo_clip_unsteal_boxes(): The
    cairo_boxes_t instance also has embedded boxes. An embedded box on the
    clip is copied to these other embedded boxes. When unstealing, the
    embedded box of the clip is used again. Thus, it does not matter anymore
    that another instance of _cairo_clip_t is used for unstealing.
    
    Fixes: https://gitlab.freedesktop.org/cairo/cairo/issues/358
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-clip-inline.h b/src/cairo-clip-inline.h
index a9f232692..d52afd313 100644
--- a/src/cairo-clip-inline.h
+++ b/src/cairo-clip-inline.h
@@ -68,7 +68,14 @@ _cairo_clip_copy_intersect_clip (const cairo_clip_t *clip,
 static inline void
 _cairo_clip_steal_boxes (cairo_clip_t *clip, cairo_boxes_t *boxes)
 {
-    _cairo_boxes_init_for_array (boxes, clip->boxes, clip->num_boxes);
+    cairo_box_t *array = clip->boxes;
+
+    if (array == &clip->embedded_box) {
+	assert (clip->num_boxes == 1);
+	boxes->boxes_embedded[0] = clip->embedded_box;
+	array = &boxes->boxes_embedded[0];
+    }
+    _cairo_boxes_init_for_array (boxes, array, clip->num_boxes);
     clip->boxes = NULL;
     clip->num_boxes = 0;
 }
@@ -76,7 +83,13 @@ _cairo_clip_steal_boxes (cairo_clip_t *clip, cairo_boxes_t *boxes)
 static inline void
 _cairo_clip_unsteal_boxes (cairo_clip_t *clip, cairo_boxes_t *boxes)
 {
-    clip->boxes = boxes->chunks.base;
+    if (boxes->chunks.base == &boxes->boxes_embedded[0]) {
+	assert(boxes->num_boxes == 1);
+	clip->embedded_box = *boxes->chunks.base;
+	clip->boxes = &clip->embedded_box;
+    } else {
+	clip->boxes = boxes->chunks.base;
+    }
     clip->num_boxes = boxes->num_boxes;
 }
 


More information about the cairo-commit mailing list