Commit graph

7730 commits

Author SHA1 Message Date
Uli Schlachter
0d3090ad84 Merge branch 'issue-411' into 'master'
PS: ensure setup DSC comments are in BeginSetup section

Closes #411

See merge request cairo/cairo!208
2021-07-23 12:11:04 +00:00
Uli Schlachter
bfedda6a18 Merge branch 'issue-264' into 'master'
Patches from #264

Closes #264

See merge request cairo/cairo!207
2021-07-23 12:09:51 +00:00
Adrian Johnson
014707b7bc Merge branch 'parse-float-errors' into 'master'
Handle _cairo_strtod() failures in parse_float()

See merge request cairo/cairo!205
2021-07-23 09:51:24 +00:00
Adrian Johnson
0f18a873ef PS: ensure setup DSC comments are in BeginSetup section
Fixes #411
2021-07-23 19:10:55 +09:30
Adrian Johnson
ae04679a08 truetype: check cmap size before allocating memory
Fixes #264
2021-07-23 18:32:44 +09:30
Uli Schlachter
6f64682ca0 Handle _cairo_strtod() failures in parse_float()
When strtod cannot do anything, it returns zero and sets the end pointer
to the beginning of the string. This commit changes the code in
parse_float() to treat this case as an error.

Without the fix from commit b7d67433b7, this commit turns the error
from an endless loop into a parse error, which is a lot better error
behaviour.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-07-21 17:16:00 +02:00
Adrian Johnson
caf422b00b cff: use correct size cast when decoding bytes to a signed int
Fixes #399
2021-07-21 22:21:37 +09:30
Adrian Johnson
ab82549f03 Merge branch 'strtod-fix' into 'master'
Ensure _cairo_strtod accepts a leading sign character

Closes #499

See merge request cairo/cairo!203
2021-07-20 23:03:37 +00:00
Jonathan Kew
b7d67433b7 Accept a leading sign character in _cairo_strtod. 2021-07-20 17:53:45 +01:00
Adrian Johnson
b6c89810f2 cff: Check subroutine number is valid before using as an array index
Fixes #413
2021-07-20 21:54:08 +09:30
Adrian Johnson
06f405c775 Merge branch 'cff-subset-leak' into 'master'
Fix memory leak in cairo_cff_font_read_cid_fontdict

See merge request cairo/cairo!192
2021-07-20 12:00:05 +00:00
Adrian Johnson
a623906bf9 Fix some type1-subset array indexing bugs
Fixes #13
Fixes #452
2021-07-20 08:22:55 +09:30
Adrian Johnson
cb0bfefba2 Update DSC documention
Fixes #380
2021-07-18 19:30:48 +09:30
Adrian Johnson
26043a2db1 Fix crash 2021-07-18 18:13:10 +09:30
Adrian Johnson
1c64d2635b Remove all gstate from _cairo_surface_tag
The gstate is not required and was causing some tag operations to be
ignored.
2021-07-18 18:13:10 +09:30
Adrian Johnson
30a0ae56d8 Create cairo version of isxdigit()
Fixes #335
2021-07-18 16:10:59 +09:30
Uli Schlachter
fc1d6caa8c Fix memory leak in cairo_cff_font_read_cid_fontdict
The function cairo_cff_font_read_cid_fontdict() has a local variable
"cairo_array_t index". This array is first filled with data from the
font with cff_index_read(). Later in this function, each resulting entry
is given to cff_dict_read(). Nothing else is done with the array.

Thus, nothing can keep a reference to "index" and thus this array has to
be finalised at the end of the function to avoid a memory leak.

This commit does that by falling through to the call to cff_index_fini()
that is already there in the error case. This function checks for each
element if its ->is_copy is true and then frees the data. However,
cff_index_read() only creates elements with ->is_copy = FALSE, thus this
does not do anything. At the end, this calls _cairo_array_fini() which
frees the array's memory.

Fixes the following memory leak according to valgrind:

 24 bytes in 1 blocks are definitely lost in loss record 173 of 490
    at 0x48386AF: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x483ADE7: realloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x4A5ECC3: _cairo_array_grow_by (cairo-array.c:115)
    by 0x4A5EEEE: _cairo_array_allocate (cairo-array.c:317)
    by 0x4A5EE95: _cairo_array_append_multiple (cairo-array.c:288)
    by 0x4A5EE6B: _cairo_array_append (cairo-array.c:265)
    by 0x4AFB12E: cff_index_read (cairo-cff-subset.c:438)
    by 0x4AFC280: cairo_cff_font_read_cid_fontdict (cairo-cff-subset.c:1022)
    by 0x4AFCD42: cairo_cff_font_read_top_dict (cairo-cff-subset.c:1232)
    by 0x4AFD145: cairo_cff_font_read_font (cairo-cff-subset.c:1351)
    by 0x4AFFDC0: cairo_cff_font_generate (cairo-cff-subset.c:2583)
    by 0x4B00D71: _cairo_cff_subset_init (cairo-cff-subset.c:2975)

Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30650
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-06-26 14:03:34 +02:00
Uli Schlachter
43a48fb6a5 Merge branch 'more-meson' into 'master'
Add more of the auto-foo build to meson

See merge request cairo/cairo!183
2021-06-17 14:25:16 +00:00
Uli Schlachter
39db60e957 Merge branch 'build-without-zlib' into 'master'
meson: Use more dependency objects & fix build without zlib

Closes #475

See merge request cairo/cairo!184
2021-06-03 15:26:07 +00:00
Uli Schlachter
2edcb1ac23 Merge branch 'jfkthame-master-patch-75366' into 'master'
[pdf-interchange] Write trees even if only LINK tags are present

Closes #487

See merge request cairo/cairo!185
2021-06-02 10:24:33 +00:00
Uli Schlachter
267d0e1c98 Merge branch 'issue_488' into 'master'
Allow empty postscript name when using a CFF font in pdf

Closes #488

See merge request cairo/cairo!186
2021-06-02 10:23:26 +00:00
afdw
9ab52c9131 Merge branch 'master' into 'svg-backend-work'
# Conflicts:
#   .gitlab-ci.yml
#   test/Makefile.sources
#   test/meson.build
2021-05-29 18:32:53 +02:00
Anton Danilkin
1e27ca7d45 Remove unused _cairo_hash_table_size 2021-05-29 18:04:45 +02:00
Calixte Denizet
a5b5679610 Allow empty postscript name when using a CFF font in pdf
- it aims to fix issue #488.
2021-05-26 19:21:08 +02:00
Jonathan Kew
60d7ff988b [pdf-interchange] Write trees even if only LINK tags are present
This avoids the PDF ending up with invalid xref entries for objects that were "reserved"
but then never output.

Fixes https://gitlab.freedesktop.org/cairo/cairo/-/issues/487.
2021-05-24 16:31:47 +00:00
Uli Schlachter
1981fb6dfb meson: Use more dependency objects
For example, to depend on cairo-script, inccairoscript was added to
"include_directories:" and libcairoscript was added to "link_with:".
This commit instead uses the libcairoscript_dep dependency everywhere.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-05-22 07:59:52 +02:00
Uli Schlachter
936e5ce8ee Merge branch 'xcb-free-xid-cache' into 'master'
xcb: Remove free XID cache

Closes #434

See merge request cairo/cairo!175
2021-05-21 15:35:59 +00:00
Uli Schlachter
91225d4dd7 Merge branch 'SVG-doc-scanner' into 'master'
#483

See merge request cairo/cairo!182
2021-05-20 15:43:16 +00:00
Uli Schlachter
1c5b4716f7 meson: Add shell script tests
There are a couple of shell scripts in src/ that run various tests. This
commit adds them to the meson build.

The one exception is check-def.sh, which I couldn't get to work and thus
only add it commented out.

check-headers.sh and check-plt.sh required some tweaking to get them to
work. check-plt.sh will print an error when run since the file
'.libs/lib*.so' does not exist, but it will still run its check
correctly.
2021-05-14 17:08:02 +02:00
Glash Gnome
7bf3a780ba #483
Fix Enum_member_description
2021-05-13 23:21:26 +00:00
Glash Gnome
7aa5e25772 Issue #482
Documentation stanza
2021-05-13 22:36:06 +00:00
Uli Schlachter
929262dd54 Merge branch 'jfkthame-master-patch-60882' into 'master'
Bail early from _cairo_image_compute_color if image is zero-sized.

See merge request cairo/cairo!177
2021-05-05 14:48:20 +00:00
Jonathan Kew
ac23567a0c Bail early from _cairo_image_compute_color if image is zero-sized.
This avoids the risk of encountering undefined behavior when computing the `pixel` pointer (even though it won't actually be used) in the case where the image width or height is zero and the data is NULL. (Observed when called from cairo_pdf_surface code when an extreme scaling transform was present, though I guess there are probably other ways to end up with such an image.)
2021-05-05 13:43:57 +00:00
Anton Danilkin
c2bf6e8ae4 Fix remaining tests 2021-05-05 00:51:01 +02:00
Anton Danilkin
5b678d8185 Fix applying shifted operators 2021-05-03 16:33:05 +02:00
Anton Danilkin
c30a031a68 Fix painting of glyphs 2021-05-03 09:58:40 +02:00
Anton Danilkin
55b57b2c68 Fix operators in Chrome 2021-05-03 00:30:57 +02:00
Anton Danilkin
10552fa78f Use g instead of symbol for glyphs 2021-05-03 00:30:14 +02:00
Anton Danilkin
62628c8886 Migrate from cairo_output_stream_t to cairo_svg_stream_t 2021-05-02 21:38:02 +02:00
Uli Schlachter
009d75b8db xcb: remove free pixmap/gc wrappers
With the last commit, these became pointless. Just switch the code to
call the underlying function directly.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-05-02 19:30:28 +02:00
Anton Danilkin
56378ee69e Do not try to emulate the fill_stroke operations ourselves 2021-05-02 19:28:55 +02:00
Uli Schlachter
c16094fc44 xcb: Remove free XID cache
cairo-xcb kept a cache of free xid to avoid calling xcb_generate_id()
later. However, this is unsafe: When libxcb runs out of ids, it asks the
X11 server for an empty range of ids to use. The X11 server of course
does not know about cairo's cache and could hand out an id that cairo
will use again later. This would then result in BadIdChoice errors
later.

Fix this by simply removing the whole cache.

Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/434
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-05-02 17:49:32 +02:00
Anton Danilkin
8f4668b4bf Disable support for SVG 2 operators 2021-05-01 23:40:02 +02:00
Anton Danilkin
bd487e64fc Add support for CAIRO_CONTENT_COLOR 2021-05-01 23:14:24 +02:00
Anton Danilkin
a3e01d9e8c Emit a transparent paint in "lerp_compositing_group"s to extends the bounds of the REMOVE_COLOR_AND_INVERT_ALPHA filter 2021-05-01 23:05:03 +02:00
Emmanuele Bassi
bd13841257 Drop the conditional inclusion of config.h
We *always* generate this file, and we depend on its existence.

The idea behind HAVE_CONFIG_H was being able to include random files
from different projects, back in a time where "libraries" were literally
just random files instead of actual shared objects.

Since we're not in the '80s any more, and our build system(s) define
HAVE_CONFIG_H *and* generate the config.h header file, we don't need a
conditional guard around its inclusion.
2021-05-01 17:05:29 +01:00
Emmanuele Bassi
bfd1602db9 Remove stray _GNU_SOURCE definitions
We define _GNU_SOURCE globally in both the Autotools build, through the
use of the AC_USE_SYSTEM_EXTENSIONS macro; and in the Meson build, with
add_project_arguments().
2021-05-01 16:58:15 +01:00
Emmanuele Bassi
8336309794 meson: Define HAVE_CONFIG_H as a project flag
Precisely what Autotools does, instead of adding it as per-target C
argument.

Once we remove HAVE_CONFIG_H checks in every source file, we'll be able
to drop it.
2021-05-01 16:55:38 +01:00
afdw
cd0082338e Merge branch 'master' into 'svg-backend-work'
# Conflicts:
#   src/cairo-gstate.c
2021-05-01 14:40:52 +00:00
Emmanuele Bassi
4c4e6127f4 Merge branch 'jfkthame-master-patch-60864' into 'master'
Don't leave the shm field uninitialized when building without shm support.

See merge request cairo/cairo!170
2021-04-29 09:18:07 +00:00