Commit graph

8269 commits

Author SHA1 Message Date
John Ralls
243938c61a [quartz] Destroy local copy of snapshot after attaching it.
Because cairo_surface_snapshot_attach refs the snapshot.

Fixes https://gitlab.freedesktop.org/cairo/cairo/-/issues/562
2022-04-23 16:38:01 -07:00
Uli Schlachter
d9a5aa9d97 Merge branch 'issue558' into 'master'
fixed double free in _cairo_ps_surface_emit_base85_string

Closes #558

See merge request cairo/cairo!312
2022-04-23 05:26:22 +00:00
Uli Schlachter
5b662c925c Merge branch 'fix-uaf-stream_internal' into 'master'
Fix a use after free in _cairo_svg_surface_create_for_stream_internal

Closes #561

See merge request cairo/cairo!315
2022-04-22 16:34:39 +00:00
Uli Schlachter
0614305093 Merge branch 'fix-double-free-mono-scan' into 'master'
Fix a double free in _cairo_mono_scan_converter_create

Closes #557

See merge request cairo/cairo!313
2022-04-22 15:49:56 +00:00
Feysh INC
d7cb417e0e Fix a use after free in _cairo_svg_surface_create_for_stream_internal
When `_cairo_svg_surface_create_for_document()` failed, it will free the
`document` by `_cairo_svg_document_destroy()`. But after `_cairo_svg_surface_create_for_document` return a error status, the `document` is still used and destoryed by `_cairo_svg_document_destroy()`.

We remove the redundant `_cairo_svg_document_destroy()` in `_cairo_svg_surface_create_for_stream_internal` to avoid this bug.

This fixes #561.

Signed-off-by: Feysh INC <opensource@feysh.com>
2022-04-22 21:24:09 +08:00
Adrian Johnson
04232d9871 Merge branch 'font-status' into 'master'
Check font status in show_text_glyphs

See merge request cairo/cairo!307
2022-04-22 12:32:21 +00:00
Feysh INC
fa8f456c2b Fix a use after free in cairo_scaled_font_create
When `font_face` is freed by `cairo_font_face_destroy()` at line 1,150,
the following call `_cairo_font_face_set_error (font_face, status)`
causes a use after free.

We moved up the `_cairo_font_face_set_error (font_face, status)` before
`cairo_font_face_destroy()` to avoid the use after free.

Signed-off-by: Feysh INC <opensource@feysh.com>
2022-04-22 17:09:47 +08:00
Feysh INC
99cd4bb3bd Fix a double free in _cairo_mono_scan_converter_create
When `_mono_scan_converter_init` failed,
`self->converter->polygon` will be freed by `polygon_fini()`. However,
the `bail` branch still called `polygon_fini()` to free
`self->converter->polygon`.

We remvoe the redundant `polygon_fini()` in `_mono_scan_converter_init`
to avoid the double free.

This fixes #557.

Signed-off-by: Feysh INC <opensource@feysh.com>
2022-04-22 16:43:59 +08:00
Ayman El Didi
a154424db3 fixed double free in _cairo_ps_surface_emit_base85_string
When taking the CAIRO_PS_COMPRESS_DEFLATE branch of the switch
statement in _cairo_ps_surface_emit_base85_string, memory is freed
a second time when closing the deflate_stream fails after performing a
write.

The status is now simply returned instead of attempting to free it
again.
2022-04-20 15:11:14 -06:00
Adrian Johnson
e15a1e9a06 Fix mingw warning
it doesn't like '%lld' in snprintf
2022-04-19 19:58:44 +09:30
Adrian Johnson
90e6f2a9f7 DWrite: Replace manual or missing ref counting with RefPtr 2022-04-19 19:58:44 +09:30
Adrian Johnson
3998a79cc2 DWrite: check 'head' table as well as 'name' when comparing fonts
There may be different versions of fonts with the same name. As an
additional check, compare the 'head' table wich contains the checksum
for the font.

Also, load the DWrite tables directly to avoid the memcpy in
load_truetype_table.
2022-04-19 19:58:44 +09:30
Adrian Johnson
2b355954a8 DWrite: ensure all private functions are static 2022-04-19 19:58:44 +09:30
Adrian Johnson
655a8a40a7 Dwrite glyph_path fails when the font matrix is not a positive uniform scale 2022-04-19 19:58:44 +09:30
Adrian Johnson
75f0ecb34e Fix Win64 compile warning 2022-04-19 19:58:44 +09:30
Adrian Johnson
1cc23206bd Fix scaled_glyph hash lookup on Win64
This was failing due to sizeof(uintptr_t) != sizeof(long) on Win64
2022-04-19 19:58:44 +09:30
Adrian Johnson
6454f65ec5 Allow the C++ code in dwrite-font to use the debug functions 2022-04-19 19:58:44 +09:30
Adrian Johnson
b4014daedf DWrite: Use twin font if default font not found
If the default font is not found, return CAIRO_INT_STATUS_UNSUPPORTED
to cause _cairo_toy_font_face_create_impl_face to create the Twin user
font fallback.
2022-04-19 19:58:44 +09:30
Adrian Johnson
672c92e19c Fix DWrite error handling
- Fix a few cases of incorrect error handling
- Use a consistent style and variable names for errors
2022-04-19 19:58:40 +09:30
Adrian Johnson
d2f65a7306 Dwrite: implement is_synthetic() 2022-04-19 19:56:32 +09:30
Adrian Johnson
0321ac99a4 cairoint.h: update some comments 2022-04-19 19:48:46 +09:30
Adrian Johnson
5b18aeffbb Replace use of ctype functions with internal version where only ASCII chars are used
In !309 Taylor R Campbell found a number of instances of ctype
incorrectly passed a signed char. In many cases, where only ASCII
characters are used, the code should have been using the cairo version
of the ctype function to avoid locale issues.
2022-04-09 22:08:57 +09:30
Adrian Johnson
092da8a997 Add CAIRO_DEBUG_PS_NO_DATE env var to remove date from PS output
Fixes #537
2022-04-05 20:04:47 +09:30
Adrian Johnson
0e284245d7 Check font status in show_text_glyphs
to prevent asserting in _cairo_scaled_font_freeze_cache()
2022-04-05 17:38:13 +09:30
Uli Schlachter
688164abaa Merge branch 'issue-551' into 'master'
Fix type1-subset indexing

Closes #551

See merge request cairo/cairo!306
2022-04-03 11:21:19 +00:00
Adrian Johnson
ff4fd6f960 Fix type1-subset indexing
Fixes #551
2022-04-03 20:06:10 +09:30
luz paz
25d588e6c0 Fix typos in doxygen and source comments 2022-03-28 16:43:03 -04:00
Adrian Johnson
136bf8c191 Ensure DWrite toy fonts can not fail if font name not found 2022-03-22 04:54:05 +10:30
Emmanuele Bassi
ad3bace256 Post-release version bump to 1.17.7 2022-03-18 18:49:24 +00:00
Emmanuele Bassi
b43e7c6f3c Release Cairo 1.17.6 (snapshot) 2022-03-18 18:40:07 +00:00
Adrian Johnson
ec54603366 Merge branch 'issue-263-2' into 'master'
Fix font count in Inkscape's win32 pdf export

See merge request cairo/cairo!296
2022-03-09 09:36:35 +00:00
Nathan Lee
82119ec2f3 Fix font count in Inkscape's win32 pdf export
Fix win32 hash comparison, where unsigned long is shorter than
uintptr_t. Follow-up to 9fbf427548.
2022-03-09 12:43:42 +11:00
Uli Schlachter
6a81bf8201 script: Implement device finish
Before this commit, calling cairo_device_finish() on a cairo-script
context did not actually do anything in the backend. Thus, it was
possible to continue emitting output on the script context even after it
was finished, which means that API user had no way of preventing
use-after-free bugs in their write callback. Bug 277 triggers this via
detaching a snapshot, but I guess one could also simply continue drawing
to a script surface.

This commit implements the finish function by closing the underlying
stream.

However, that was not enough to fix things. This commit also turns
writing into a stream into a no-op after the stream was closed.

I checked that the new test case actually fails before this commit and
is indeed fixed by it.

Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/277
Signed-off-by: Uli Schlachter <psychon@znc.in>
2022-03-08 18:11:23 +01:00
Adrian Johnson
989d368dc5 DWrite font docs 2022-03-05 16:56:56 +10:30
Adrian Johnson
ddac44db5d On vector surfaces render color glyphs in the fallback resolution 2022-03-01 21:04:22 +10:30
Adrian Johnson
fa3a1bca7d Remove the extra API from the mozilla DWrite 2022-02-27 20:40:52 +10:30
Adrian Johnson
5635c75a2c dwrite: add color font support 2022-02-27 20:20:24 +10:30
Adrian Johnson
fdf2a9b4c0 dwrite_font param is not used 2022-02-27 15:44:58 +10:30
Adrian Johnson
7e644409ea Fix dwrite toy fonts 2022-02-27 15:44:58 +10:30
Adrian Johnson
fa76ebec03 Fix some warnings and use _cairo_malloc where applicable 2022-02-27 15:44:58 +10:30
Adrian Johnson
28ce8463af Fix check doc errors 2022-02-27 15:44:58 +10:30
Adrian Johnson
ed36d85bf6 Fix msvc c++ compile error 2022-02-27 15:44:58 +10:30
Adrian Johnson
90ca635472 Import win32 dwrite font backend from
https://hg.mozilla.org/mozilla-central/file/7338d7d940913147f8a1b1e8bd2b25ab255f4373/gfx/cairo/cairo/src

and add to the meson build. I've omitted the
cairo_surface_set_subpixel_antialiasing() API and its use in quartz
and dwrite. Not sure if that is needed.

It compiles. Not tested.
2022-02-27 15:44:58 +10:30
Adrian Johnson
1a799577b2 Merge branch 'issue-526' into 'master'
pdf: ensure urls and filename strings are correctly encoded

Closes #526

See merge request cairo/cairo!266
2022-02-27 03:51:50 +00:00
Christopher Chavez
5e1dd84796 quartz: Fix spelling in comment 2022-02-26 09:17:28 +00:00
Uli Schlachter
1781e59c57 Merge branch 'drop-backends' into 'master'
Remove old backends

See merge request cairo/cairo!285
2022-02-25 15:44:51 +00:00
Emmanuele Bassi
9b9028c160 Drop cairo-vg surface
OpenVG is a failed experiment from 10 years ago, and nobody has been
using the cairo-vg surface in pretty much the same amount of time.
2022-02-25 02:09:58 +00:00
Emmanuele Bassi
fc3437128d Remove cairo-directfb
Nobody cares about DirectFB any more, not even the people that registered
and maintained the DirectFB domain.
2022-02-25 02:03:35 +00:00
Emmanuele Bassi
803afe6edd tanis: Remove cairo-cogl
Cogl's upstream is unmaintained, and has been for the past 6 years.
2022-02-25 01:58:24 +00:00
Emmanuele Bassi
1409079eef Remove cairo-drm
The DRM backend has always been a science experiment, but now it hasn't
been built in more than 10 years, and it's completely broken.
2022-02-25 01:54:29 +00:00