Commit graph

11912 commits

Author SHA1 Message Date
Uli Schlachter
3c00a849f6 Merge branch 'fix-cairo-status-is-error' into 'master'
Add missing parentheses to _cairo_status_is_error and _cairo_int_status_is_error

See merge request cairo/cairo!161
2021-04-25 07:20:26 +00:00
Anton Danilkin
f4a3236d14 Add missing parentheses to _cairo_status_is_error and _cairo_int_status_is_error 2021-04-24 14:50:30 +02:00
Uli Schlachter
de2a71b230 Merge branch 'svg-ci' into 'master'
Enable SVG in CI

See merge request cairo/cairo!156
2021-04-23 19:40:46 +00:00
Heiko Lewin
ec2933b06e Merge branch 'wip/Jehan/subpixel-antialiasing' into 'master'
src: do not override explicitly requested grayscale antialiasing.

See merge request cairo/cairo!114
2021-04-20 12:35:17 +00:00
Tim-Philipp Müller
d4617e31be Merge branch 'no-fontconfig-on-windows' into 'master'
Don't build fontconfig on Windows

See merge request cairo/cairo!159
2021-04-20 10:33:20 +00:00
Matthias Clasen
f6a3f6d8ad Don't build fontconfig on Windows
mesons 'auto' is too eager to build things. Building
fontconfig as a subproject on Windows is not the right
thing, unless it was explictly requested.
2021-04-19 11:49:31 -04:00
Uli Schlachter
0392dd783c Ignore create-for-stream failure with svg
The create-for-stream test verifies that writing something to a file and
writing it to an in-memory surface produces the same output. The test
currently fails when the svg backend is tested with:

TEST: create_for_stream TARGET: pdf RESULT: PASS
svg: Stream based output differ from file output for output/create-for-stream.out.svg.
TEST: create_for_stream TARGET: svg RESULT: FAIL

I guess this is because svg uses unique IDs for surfaces, meaning that
drawing two times the same thing in the same process can produce
different outputs. However, this is just a guess and I didn't
investigate further.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-04-18 13:00:07 +02:00
Uli Schlachter
2f8b5bc7b2 Add hack to ignore a svg test crashes
This adds a special hack to the test suite to ignore the crashes for
self-copy and self-copy-overlap for the svg backend in CI.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-04-18 12:25:13 +02:00
Uli Schlachter
0c9dacbc43 svg: Reject raster sources
This hopefully fixes the raster-source test case crashing:

cairo-svg-surface.c:2269: _cairo_svg_surface_emit_pattern: Assertion `!"reached"' failed.

I cannot / did not test this change locally and rely on CI to tell me
whether this works.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-04-18 09:32:44 +02:00
Uli Schlachter
9ea171b132 Ignore current svg failures in CI
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-04-18 08:40:17 +02:00
Uli Schlachter
ca3423a701 Install gtk2-devel on CI
From config.log from CI:

configure:27855: $PKG_CONFIG --exists --print-errors "$librsvg_DEPENDENCY gdk-2.0"
Package gdk-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gdk-2.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gdk-2.0', required by 'virtual:world', not found
configure:27858: $? = 1
Package 'gdk-2.0', required by 'virtual:world', not found
configure:27885: result: no
configure:27921: WARNING: SVG backend will not be tested since librsvg >= 2.35.0 is not available

According to Google, it seems like gtk2-devel is the right package to
get gdk-2.0.pc.

Thanks a lot to @tpm for explaining that I also have to change the TAG
variable.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-04-18 08:18:49 +02:00
Uli Schlachter
f8157ae751 Add config.log to build artefacts
This fail is not large, so doesn't "cost much", but it helps in figuring
out build problems in CI like "what exactly is missing for the SVG
backend?".

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-04-18 08:01:09 +02:00
Heiko Lewin
7de7d57592 Merge branch 'ci-make-test-succeeds' into 'master'
CI: Actually run cairo-test-suite

See merge request cairo/cairo!140
2021-04-17 10:01:17 +00:00
Uli Schlachter
a31c7395a1 test-suite: Add a new mechanism for XFAILs
This commit adds a new mechanism to mark tests as expected to fail via
an environment variable. For example, if you expect the tests "foo" and
"bar" to fail when run under image.argb32, you would set

   CAIRO_TEST_IGNORE_image_argb32=foo,bar

The test suite then expects these tests to fail and treats this as
xfail. If they do not fail, this is a failure on its own.

This new feature is explicitly not documented much, because it is only
used as a stopgap measure to make our CI more useful: Right now the test
suite runs on CI, but the result is ignored. This new feature allows to
mark the known failures as xfail without too much work. When the
situation changes, this will be noticed as a new test suite failure.
Thus, these environment variables to not run into the danger of still
containing tests that were already fixed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-04-17 10:01:17 +00:00
Uli Schlachter
dfd543d013 Merge branch 'fix-cairo-malloc' into 'master'
Change int to size_t in the _cairo_malloc function family

See merge request cairo/cairo!153
2021-04-17 07:06:06 +00:00
Anton Danilkin
67099a091e Change int to size_t in the _cairo_malloc function family
This should allow to use them for allocating large amounts of memory.

Also use explicit checks for zeros to not make the compiler think that it is a boolean context.
2021-04-13 19:20:05 +02:00
Tim-Philipp Müller
c287fb3a1f Merge branch 'win32-atomic' into 'master'
atomic: Add support for WIN32 atomic operations

See merge request cairo/cairo!151
2021-04-12 08:30:57 +00:00
Heiko Lewin
277a1daec8 Merge branch 'type1_find_segments_bounds_check' into 'master'
Fix out of bounds access in cairo_type1_font_subset_find_segments

See merge request cairo/cairo!146
2021-04-11 16:35:03 +00:00
Uli Schlachter
1484cfa551 Fix out of bounds access in cairo_type1_font_subset_find_segments
This function parses some raw font data and it trusts the font to be
well-formed. This means that a font can just say "this segment is a
gigabyte large" and the code will happily jump ahead in memory. Bad
things then happen in practice.

Fix this by adding lots of bounds check.

Also, an existing bounds check makes sure we are still before the end of
the data, but then happily reads the next six bytes. Fix this by making
sure we actually have six bytes of data.

No regression test since the last few times I tried to do this for font
issues, I ended up with a large/huge blob of font data. Too large for
the test suite.

Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27969
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-04-11 16:35:02 +00:00
Uli Schlachter
26663cf3be Merge branch 'fix_obvious_ub' into 'master'
Fix undefined left-shifts

See merge request cairo/cairo!149
2021-04-11 05:37:49 +00:00
Heiko Lewin
3ca8a46caf Minor corrections 2021-04-11 02:07:10 +02:00
Seungha Yang
cd2b91c62e atomic: Add support for WIN32 atomic operations
Windows provides atomic operation APIs so use it
2021-04-09 01:26:20 +09:00
Uli Schlachter
1904d7bf35 Merge branch 'fix-467' into 'master'
Rename cairo_lines_compare_at_y into _cairo_lines_compare_at_y and fix syntax

Closes #467

See merge request cairo/cairo!150
2021-04-02 13:43:39 +00:00
Marc Jeanmougin
d2a37ba60e
Rename cairo_lines_compare_at_y into _cairo_lines_compare_at_y and fix syntax
Fixes https://gitlab.freedesktop.org/cairo/cairo/-/issues/467
2021-04-02 14:35:46 +02:00
Heiko Lewin
518ba13779 Fix undefined left-shifts 2021-03-31 12:20:34 +02:00
Uli Schlachter
44f808fce9 Merge branch 'use-after-scope' into 'master'
Avoid a use-after-scope

Closes #453

See merge request cairo/cairo!143
2021-03-25 15:51:32 +00:00
Uli Schlachter
33cce5dc37 Merge branch 'pdf-mime-data' into 'master'
"Fix" the pdf-mime-data test

See merge request cairo/cairo!142
2021-03-25 15:51:13 +00:00
Uli Schlachter
c48ea2737c Merge branch 'serial-test-harness' into 'master'
Use the serial automake test harness

See merge request cairo/cairo!138
2021-03-25 15:50:44 +00:00
Uli Schlachter
5090dc3f4a Merge branch 'flush-in-tests' into 'master'
test suite: fflush() before fork()

See merge request cairo/cairo!139
2021-03-25 15:50:22 +00:00
Uli Schlachter
f5a4ec8ada Merge branch 'mime-unique-id' into 'master'
Fix the mime-unique-id test for me

See merge request cairo/cairo!141
2021-03-25 15:49:50 +00:00
Tim-Philipp Müller
104dfd8b04 Merge branch 'ci-bump-windows-image' into 'master'
ci: bump windows image to latest version to fix github ssl certificate issues

See merge request cairo/cairo!148
2021-03-22 11:22:09 +00:00
Tim-Philipp Müller
b40b1afaec ci: bump windows image to latest version to fix github ssl certificate issues 2021-03-20 16:16:27 +00:00
Tim-Philipp Müller
f604b4ba92 Merge branch 'gyf-table-leak' into 'master'
Fix a leak in an error path

See merge request cairo/cairo!144
2021-03-10 16:57:08 +00:00
Tim-Philipp Müller
b718dae717 Merge branch 'meson-make-cairo-trace-executable' into 'master'
meson: make cairo-trace executable

Closes #462

See merge request cairo/cairo!145
2021-03-09 19:08:29 +00:00
Tim-Philipp Müller
ca478e0327 meson: make cairo-trace executable
Install with exec flag set and make sure tool is
executable in build directory as well (by making
the input file in the source directory executable).

Fixes #462
2021-03-09 10:59:57 +00:00
Uli Schlachter
2af4412aa3 Fix a leak in an error path
Tested with valgrind. Before this patch, I got the following "definitely
lost" entry, which is gone afterwards:

94,416 bytes in 1 blocks are definitely lost in loss record 427 of 427
   at 0x483877F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x4B053F8: cairo_truetype_font_write_glyf_table (cairo-truetype-subset.c:625)
   by 0x4B06219: cairo_truetype_font_generate (cairo-truetype-subset.c:991)
   by 0x4B06917: cairo_truetype_subset_init_internal (cairo-truetype-subset.c:1159)
   by 0x4B06D72: _cairo_truetype_subset_init_pdf (cairo-truetype-subset.c:1255)
   by 0x4B6B113: _cairo_pdf_surface_emit_truetype_font_subset (cairo-pdf-surface.c:5892)
   by 0x4B6C2AD: _cairo_pdf_surface_emit_unscaled_font_subset (cairo-pdf-surface.c:6366)
   by 0x4B02FC7: _cairo_sub_font_collect (cairo-scaled-font-subsets.c:741)
   by 0x4B03A7A: _cairo_scaled_font_subsets_foreach_internal (cairo-scaled-font-subsets.c:1062)
   by 0x4B03B21: _cairo_scaled_font_subsets_foreach_unscaled (cairo-scaled-font-subsets.c:1090)
   by 0x4B6C3ED: _cairo_pdf_surface_emit_font_subsets (cairo-pdf-surface.c:6412)
   by 0x4B62B1A: _cairo_pdf_surface_finish (cairo-pdf-surface.c:2222)

To reproduce, run the test case from the below link.

Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28023
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-09 11:14:09 +01:00
Uli Schlachter
e5b9d96f22 Avoid a use-after-scope
This is the same fix as commit b345be5afe, but in a different place in
the same file.

Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/453
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-09 07:53:50 +01:00
Uli Schlachter
2f25fa68c0 test/pdf-mime-data.c: Check for pdfimages
Currently, the pdf-mime-data check just fails for me with the following
output:

    sh: 1: pdfimages: not found
    pdf-mime-data: FAIL

pdf-mime-data.log contains:

    pdfimages failed with exit status 32512

Since I do not have pdfimages installed... yeah.

This commit "fixes" that problem by skipping the test if pdfimages is
not available. No idea if it would pass if it were available, but I do
not feel like installing pdfimages just to test.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-08 17:31:37 +01:00
Uli Schlachter
2a8d90c6fc pdf-mime-data: Fix for out-of-tree builds
This makes the code use the existing helper for loading PNGs that also
considers the $srcdir environment variable. This makes it find the file
in out of tree builds.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-08 17:27:52 +01:00
Uli Schlachter
0c64c216aa pdf-mime-data: Fix error checking
I am not quite sure, but an if for "ignore this error if something
failed" seems wrong. Either this should have compared against status2 or
checked for success. This commit fixes the code for the latter.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-08 17:26:50 +01:00
Uli Schlachter
433d9eb109 Update the PDF size limit in mime-unique-id
The test mime-unique-id checks that some images are only embedded once
in a PDF. It does so by checking if the file size is within some
expected bounds. However, the test fails for me because the file is too
small. Yes, too *small*.

Fix this by updating the test to expect my current file size.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-08 16:30:33 +01:00
Uli Schlachter
0fd2197e2b test/mime-unique-id: Fix for out-of-tree builds
Instead of failing because it did not find an image, this now fails for
me since the PDF is too small (???).

This new code is modelled after cairo_test_create_surface_from_png().

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-08 16:28:51 +01:00
Uli Schlachter
446d3972e5 test suite: fflush() before fork()
Forking a process also duplicates the buffers of FILE*s. Thus, if there
is pending data, both the parent and the child process will write
things. This is seldom a good idea.

This issue was not noticed so far since by default the test suite
already calls fflush() a lot. However, when stdout and stderr are both
not a tty (according to isatty(1) and isatty(2)), these flushes are
skipped. The result is that the child process repeat the full output
from the test suite starting with "Compiled against cairo 1.17.4,
running on 1.17.4."

To reproduce this problem run: ./cairo-test-suite 2>&1 | cat

Fix this by flushing all the files that I managed to find before fork().

Thanks to Pekka Paalanen for helping me figure this out.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-08 13:45:07 +01:00
Uli Schlachter
7788000be0 Merge branch 'meson-allow-skipping-of-run-check-for-ipc-rmid-deferred-release-in-cross-build' into 'master'
meson: allow skipping of run check for IPC_RMID_DEFERRED_RELEASE

Closes #408

See merge request cairo/cairo!134
2021-03-05 08:08:55 +00:00
Tim-Philipp Müller
71ece6d149 Merge branch 'alatiera/exclude-artifacts' into 'master'
ci: cleanup the autotools artifacts a bit

Closes #465

See merge request cairo/cairo!137
2021-03-04 11:09:29 +00:00
Jordan Petridis
921cc3e57a
ci: cleanup the autotools artifacts a bit
Exclude .trace and .cs file from being exported.
This brings down the generated artifacts size to 73mb.

Close #465
2021-03-04 12:51:12 +02:00
Uli Schlachter
57068e62a5 Use the serial automake test harness
Once upon a time, automake had one way to run tests. Apparently this is
(nowadays?) called the serial test harness. Then, in some release (I do
not remember which one), the parallel test harness became the default.

The parallel harness runs all tests in parallel, but does not (really)
show the test output, but instead has output redirected to files. Sort
of. I did not find the result of my printf() anywhere.

The automake docs strongly discourage using the serial test harness [0],
but do not really say why. For cairo, I do not see problems:

We have some quick, small checks (e.g. is cairo_public used where needed
in the public headers). And then there is the big, heavy-weight test
suite (cairo-test-suite). Thus, running these things in parallel has
basically no benefits.

Additionally, cairo-test-suite takes really, really long. Not seeing any
output while it is running is annoying. Failing to find the output even
in files is bad.

Thus, since I do not see any benefits and only downsides to the parallel
test harness, this commit switches to the serial one.

[0]: https://www.gnu.org/software/automake/manual/html_node/Serial-Test-Harness.html

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-04 08:10:10 +01:00
Tim-Philipp Müller
d847f1d621 Merge branch 'spectre-dep' into 'master'
meson: Move libspectre to test_deps

Closes #425

See merge request cairo/cairo!135
2021-03-01 14:10:04 +00:00
Uli Schlachter
55a5951742 meson: Move libspectre to test_deps
libspectre is only used for ps tests. Adding it to "deps" needlessly
makes it show up in cairo.pc's Requires.private.

Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/425
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-01 14:06:02 +01:00
Tim-Philipp Müller
1bec56ea8a meson: allow skipping of run check for IPC_RMID_DEFERRED_RELEASE
The run check is particularly annoying in cross-compile scenarios,
so allow bypassing the check by having the user provide the value
via a cross file or native file:

  [properties]
  ipc_rmid_deferred_release = true

Closes #408
2021-02-25 10:56:45 +00:00