Commit graph

12512 commits

Author SHA1 Message Date
Adrian Johnson
72cc5ae5fa Merge branch 'pr/Fix617' into 'master'
Fix wrong paginated surface size (issue #617)

Closes #617

See merge request cairo/cairo!395
2023-01-10 11:10:08 +00:00
Adrian Johnson
1cfea7d979 Merge branch 'colr-v1' into 'master'
COLRv1 glyph renderer

See merge request cairo/cairo!397
2023-01-10 11:09:11 +00:00
Tim-Philipp Müller
c76a699f6c Merge branch 'no-more-autotools' into 'master'
Remove autotools

See merge request cairo/cairo!398
2023-01-09 00:25:48 +00:00
Adrian Johnson
c756836dbe Rename INSTALL.meson and README.meson 2023-01-08 22:28:29 +10:30
Adrian Johnson
efe303d9db Remove autotools build 2023-01-08 22:27:47 +10:30
Adrian Johnson
7471a323a7 Enable error log output of meson test --no-suite=slow in CI
So the cause of the failure can be seen.
2023-01-08 15:15:13 +10:30
Adrian Johnson
dd8f55100a Require -DDEBUG_ENABLE_COLR_V1 to enable the COLR v1 renderer
Once there is a FreeType release where the COLR v1 API is no longer
marked experimental, we can change this to a version check.
2023-01-08 15:15:13 +10:30
Adrian Johnson
89d004432b COLRv1: Use cairo style and types 2023-01-08 15:15:13 +10:30
Adrian Johnson
2dfc52064e Use cairo-ft-font.c decompose function 2023-01-08 15:15:13 +10:30
Adrian Johnson
1129b194b5 Render COLRv1 to a recording surface 2023-01-08 15:15:13 +10:30
Adrian Johnson
9ed34574a6 Fix a couple of bugs and add a #define to enable debug 2023-01-08 15:15:13 +10:30
Adrian Johnson
3c8dec60e5 Integrate COLR v1 renderer with cairo-ft-font.c 2023-01-08 15:15:13 +10:30
Adrian Johnson
e892d0e92f COLRv1 glyph renderer
Matthias Clasen's COLR v1 glyph renderer from !370
2023-01-08 10:00:29 +10:30
Benjamin Hennion
477c134412 Make _cairo_paginated_surface_set_size takes double-typed width and
height (instead of integers).

    Both cairo_pdf_surface_set_size and cairo_ps_surface_set_size passed on
    their width and height arguments (of type double) directly to
    _cairo_paginated_surface_set_size(cairo_paginated_surface_t*, int, int),
    so the width and height were truncated.
    A small part of the surface was then inaccessible for drawing (stripes
    on the right and bottom of the surface).
    This fixes that.
2023-01-07 13:08:38 +01:00
Uli Schlachter
387d2f0739 Merge branch 'svg-glyph-renderer-leak' into 'master'
Fix a leak in the cairo-svg-glyph-renderer

See merge request cairo/cairo!394
2023-01-05 20:00:29 +00:00
Uli Schlachter
3a7bb13582 Fix a leak in the cairo-svg-glyph-renderer
This svg

  <svg /><path stroke-dasharray=""fill="url(# "id=""/>

Lead to two memory leaks like the following:

 98 bytes in 98 blocks are definitely lost in loss record 2 of 11
    at 0x48407B4: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x4EB8789: strdup (strdup.c:42)
    by 0x493C450: save_graphics_state (cairo-svg-glyph-render.c:2894)

This happened because the value of gs->dash_array was replaced without
freeing the previous value. This commit adds the missing free and fixes
the leak.

Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54830
Signed-off-by: Uli Schlachter <psychon@znc.in>
2023-01-05 17:14:34 +01:00
Adrian Johnson
13a0474641 Merge branch 'mingw-fixes' into 'master'
Fix mingw build failure when SVG fonts enabled

See merge request cairo/cairo!389
2023-01-03 19:03:50 +00:00
Adrian Johnson
4e51d1536f Merge branch 'separate-check-refs' into 'master'
Move check-refs.sh into its own test

See merge request cairo/cairo!388
2023-01-03 19:03:26 +00:00
Uli Schlachter
74ec3ee086 Merge branch 'ci-bump-windows-image' into 'master'
ci: bump windows tag to latest

See merge request cairo/cairo!392
2023-01-03 16:53:01 +00:00
Tim-Philipp Müller
2132e801db ci: bump windows tag to latest
Which will be in runner cache already.
2023-01-03 16:07:06 +00:00
Adrian Johnson
7eb121646e Merge branch 'undo-ignore' into 'master'
Remove the test ignore that was unintentionaly committed in !380

See merge request cairo/cairo!390
2023-01-03 08:55:27 +00:00
Adrian Johnson
6b2a9a0f77 Remove the test ignore that was unintentionaly committed in !380 2023-01-03 18:43:02 +10:30
Adrian Johnson
ca0f8ffd84 Merge branch 'foreground-color-in-group' into 'master'
User-fonts fails when foreground color used inside a group

See merge request cairo/cairo!380
2023-01-03 07:45:35 +00:00
Adrian Johnson
f0ce8658f9 Fix user-font with foreground in group failures on image, PDF, and PS 2023-01-03 17:37:36 +10:30
Adrian Johnson
3d102f25c9 Use _cairo_strndup where appropriate 2023-01-03 16:01:51 +10:30
Adrian Johnson
6d03a18649 Fix leak 2023-01-03 15:28:02 +10:30
Adrian Johnson
dcc6c2c806 Fix mingw warning: "ERROR" redefined 2023-01-03 15:27:05 +10:30
Adrian Johnson
82aa3fb80e Fix bug in strndup implementation
The strlen() could go past the n bytes and into a memory address we
don't have read access to.
2023-01-03 15:27:05 +10:30
Adrian Johnson
5e0e40e3c5 Fix mingw build failure when SVG fonts enabled
Add missing strndup() function. Copied the strndup() implementation
from util/cairo-missing/strndup.c plus a bug fix.
2023-01-03 15:27:03 +10:30
Adrian Johnson
e25dfaed8c Move check-refs.sh into its own test
to avoid make the tests wait too long before they start
2023-01-03 08:03:38 +10:30
Uli Schlachter
1af1e11254 Merge branch 'ci-tests-meson' into 'master'
Switch CI tests from autotools to meson

See merge request cairo/cairo!300
2023-01-02 18:00:49 +00:00
Adrian Johnson
47645dd674 Merge branch 'tests' into 'master'
Support check-def.sh in meson build

See merge request cairo/cairo!248
2023-01-02 12:57:31 +00:00
Adrian Johnson
e8b622ebe6 Support check-def.sh in meson build
The original check-def.sh called make. In meson, check-def.sh is
replaced by two shell scripts, one for generating cairo.def, the other
for comparing with the library symbols.

The library filename appended to the cairo.def has been omitted as
this is only reqired in autotools builds where the cairo.def is also
to generate cairo.dll in the windows build.

make-cairo-def.sh is based on the cairo.def target in Makefile.am.
meson-check-def.sh is based on check-def.sh
2023-01-02 22:43:39 +10:30
Adrian Johnson
7f83c30943 Merge branch 'test-readme' into 'master'
Add README.meson file for meson test

See merge request cairo/cairo!385
2023-01-02 10:54:17 +00:00
Adrian Johnson
39081b0c40 Add README.meson file for meson test 2023-01-02 20:46:39 +10:30
Uli Schlachter
8dbc5893f7 Merge branch 'jpx-out-of-bounds' into 'master'
Fix possible out-of-bound reads in get_jpx_info

See merge request cairo/cairo!387
2023-01-02 09:28:42 +00:00
Uli Schlachter
3cc15cb40e Merge branch 'duplicate-ref-images' into 'master'
Remove duplicate reference images & run check-refs.sh in CI to ensure that no new duplicate images are added

See merge request cairo/cairo!384
2023-01-02 09:04:16 +00:00
Uli Schlachter
d9008ff8c1 Merge branch 'jbig2-out-of-bounds-read' into 'master'
Fix an out of bounds read in _jbig2_get_next_segment()

See merge request cairo/cairo!386
2023-01-02 09:04:00 +00:00
Uli Schlachter
e60e562fd1 Fix possible out-of-bound reads in get_jpx_info
Inspired by [1], I looked into the other functions in
cairo-image-info.c. This commit fixes the possible out-of-bound reads
that I found just by staring at the code.

_jpx_next_box() would happily read beyond the end of the data via
get_unaligned_be32(). This commit adds checks that at least for bytes of
data are available.

Additionally, I made this function check that its returned pointer is
within bounds, just because I found this easier to reason about.

Also, _jpx_extract_info() did not check that it had enough data to read.
This is fixed by making the function fallible and giving it information
about the end of data.

[1]: https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/386

Signed-off-by: Uli Schlachter <psychon@znc.in>
2023-01-01 14:01:46 +01:00
Uli Schlachter
d623090b32 Fix an out of bounds read in _jbig2_get_next_segment()
Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38451
Signed-off-by: Uli Schlachter <psychon@znc.in>
2023-01-01 09:43:33 +01:00
Adrian Johnson
c51b5e8021 Copy completion.bash to $builddir/test 2023-01-01 16:27:02 +10:30
Adrian Johnson
513c49e623 user-font-color test: draw glyphs again inside a group
This demonstrates a bug in user-fonts with foreground color inside a
group.
2023-01-01 14:00:00 +10:30
Uli Schlachter
52e964da69 Merge branch 'speed-up-coverage-column-triangles' into 'master'
Speed up coverage-column-triangles test

Closes #498

See merge request cairo/cairo!379
2022-12-31 17:30:29 +00:00
Simon McVittie
ff28595eff CI: Update test artifacts to be appropriate for out-of-tree Meson build
Signed-off-by: Simon McVittie <smcv@debian.org>
2022-12-31 17:09:40 +01:00
Uli Schlachter
fbd71a0a45 Switch CI tests from autotools to meson
The autotools build files are on their way out (See !298). As
preparation for dropping the autotools build, this commit switches CI to
run tests based on the meson build instead of the autotools one.

No functional changes intended.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2022-12-31 17:09:40 +01:00
Uli Schlachter
7de261b0b1 Merge branch 'script-bug-277' into 'master'
script: Implement device finish

Closes #277

See merge request cairo/cairo!292
2022-12-31 15:13:59 +00:00
Uli Schlachter
997870601b Run check-refs.sh in CI
The check-refs.sh script detects duplicate reference images. This commit
adds it to be run by CI. For this, the script is extended with a proper
exit code.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2022-12-31 16:05:27 +01:00
Uli Schlachter
d546a78c6f Remove duplicate reference images
Running test/check-refs.sh reports:

redundant: arc-direction.pdf.ref.png and arc-direction.ref.png are byte-by-byte identical files
redundant: big-little-triangle.traps.argb32.ref.png and big-little-triangle.argb32.ref.png are byte-by-byte identical files
redundant: big-little-triangle.traps.rgb24.ref.png and big-little-triangle.rgb24.ref.png are byte-by-byte identical files
redundant: clip-fill-rule.pdf.rgb24.ref.png and clip-fill-rule.rgb24.ref.png are byte-by-byte identical files
redundant: dash-offset-negative.pdf.ref.png and dash-offset-negative.ref.png are byte-by-byte identical files
redundant: font-matrix-translation.traps.ref.png and font-matrix-translation.ref.png are byte-by-byte identical files
redundant: ft-show-glyphs-positioning.traps.ref.png and ft-show-glyphs-positioning.ref.png are byte-by-byte identical files
redundant: ft-show-glyphs-table.traps.ref.png and ft-show-glyphs-table.ref.png are byte-by-byte identical files
redundant: glyph-cache-pressure.traps.ref.png and glyph-cache-pressure.ref.png are byte-by-byte identical files
redundant: inverse-text.traps.ref.png and inverse-text.ref.png are byte-by-byte identical files
redundant: line-width-large-overlap-offset.ps.ref.png and line-width-large-overlap-offset.ref.png are byte-by-byte identical files
redundant: partial-clip-text-right.traps.ref.png and partial-clip-text-right.ref.png are byte-by-byte identical files
redundant: partial-clip-text-top.traps.ref.png and partial-clip-text-top.ref.png are byte-by-byte identical files
redundant: record90-fill-alpha.pdf.ref.png and record90-fill-alpha.ref.png are byte-by-byte identical files
redundant: record90-paint-alpha-clip.quartz.ref.png and record90-paint-alpha-clip.ref.png are byte-by-byte identical files
redundant: record-fill-alpha.pdf.ref.png and record-fill-alpha.ref.png are byte-by-byte identical files
redundant: recordflip-whole-fill-alpha.quartz.ref.png and recordflip-whole-fill-alpha.ref.png are byte-by-byte identical files
redundant: recordflip-whole-paint-alpha-clip-mask.quartz.ref.png and recordflip-whole-paint-alpha-clip-mask.ref.png are byte-by-byte identical files
redundant: record-mesh.ps.ref.png and record-mesh.ref.png are byte-by-byte identical files
redundant: select-font-face.traps.ref.png and select-font-face.ref.png are byte-by-byte identical files
redundant: show-glyphs-advance.traps.ref.png and show-glyphs-advance.ref.png are byte-by-byte identical files
redundant: show-text-current-point.traps.ref.png and show-text-current-point.ref.png are byte-by-byte identical files
redundant: text-antialias-gray.traps.ref.png and text-antialias-gray.ref.png are byte-by-byte identical files

This commit removes these redundant files.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2022-12-31 15:56:33 +01:00
Uli Schlachter
001df8ad17 Merge branch 'improve-offset-size-checking' into 'master'
Improve cff index reading code

See merge request cairo/cairo!383
2022-12-31 14:01:08 +00:00
Uli Schlachter
c24c657525 Improve cff index reading code
In a recent MR [1], Adrian Johnson writes:

  For additional safety you could change the unsigned long to size_t
  since long is 32-bits on Win64. The CFF spec says the offset size used
  in decode_index_offset must be between 1 and 4 so you could range
  check that to avoid overflowing the offset.

This commit implements exactly that.

[1]: https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/382#note_1700743

Signed-off-by: Uli Schlachter <psychon@znc.in>
2022-12-31 14:21:28 +01:00