Commit graph

12086 commits

Author SHA1 Message Date
Adrian Johnson
47c4dc4fcf Add meson install instructions 2021-07-25 11:33:42 +00:00
Adrian Johnson
908b243ab8 Merge branch 'svg-create-for-stream' into 'master'
svg: Fix create-for-stream test case

See merge request cairo/cairo!212
2021-07-25 03:21:03 +00:00
Uli Schlachter
099d71fb9f Merge branch 'issue-336' into 'master'
tags: allow links to page numbers not yet created

Closes #336

See merge request cairo/cairo!211
2021-07-24 12:58:17 +00:00
Uli Schlachter
4c6b604bd5 svg: Fix create-for-stream test case
Commit 2fbd53 added another test to create-for-stream that failed for
cairo-pdf. Manual testing shows that this test also fails for cairo-svg.
However, this was not noticed because even before this addition to the
test, create-for-stream already failed for cairo-svg. Since the
introduction on CI was done based on "let's ignore all current
failures", this hid the error.

This commit applies the trivial fix for cairo-svg to make this test
pass. It is basically the same error that cairo-pdf had.

Additionally, this removes the hack to ignore create-for-stream failures
in CI since it is now no longer necessary.

Thanks to Knut Peterson for reporting this [0].

[0]:
https://lists.cairographics.org/archives/cairo/2021-July/029291.html

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-07-24 14:42:26 +02:00
Adrian Johnson
f7c7bcb603 tags: allow links to page numbers not yet created
Previously, forward references were required to use named destinations.

This patch is based on the patch in #336 by Guillaume Ayoub <guillaume.ayoub@kozea.fr>
that converted all links to indirect objects written at the end of the document.

I have reworked the patch so that only forward references to future page numbers are
written as indirect objects. Backward references and named destinations remain as they
are. This is to minimize the number of objects written to the PDF file.

Fixes #336
2021-07-24 21:33:09 +09:30
Adrian Johnson
994eccefc0 Merge branch 'recording-playback-nothing-to-do' into 'master'
Don't assert on NOTHING_TO_DO during recording replay.

See merge request cairo/cairo!195
2021-07-24 08:19:16 +00:00
Adrian Johnson
d12e55672c Merge branch 'pdf-stdio-write-errors' into 'master'
pdf: Properly pass on stdio write errors

See merge request cairo/cairo!210
2021-07-24 08:08:44 +00:00
Uli Schlachter
e689e67004 Fix build on windows
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-07-23 17:32:39 +02:00
Uli Schlachter
2fbd53a6b3 pdf: Properly pass on stdio write errors
cairo-pdf was silently ignoring write errors in
_cairo_pdf_surface_finish(). Any write errors that happened here ended
up setting a "status" variable, but the value in this variable was then
unused.

This commit fixes this bug by passing this error on to the caller.

Additionally, this also adds a test case for this behaviour based on
writing to /dev/full. This file is non-standard and thus the test first
checks that this file exists and is writable before trying to write to
it.

This bug was found based on a report from Knut Petersen [0].

[0]: https://lists.cairographics.org/archives/cairo/2021-July/029281.html

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-07-23 17:22:16 +02:00
Jonathan Kew
2d488b3596 Don't assert on NOTHING_TO_DO during recording replay. 2021-07-23 15:19:05 +01:00
Uli Schlachter
b408352d45 Merge branch 'issue-381' into 'master'
Always define _cairo_utf8_to_utf16 on Windows

Closes #381

See merge request cairo/cairo!209
2021-07-23 12:11:30 +00:00
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
Peter Wang
bd54a1bf98 Always define _cairo_utf8_to_utf16 on Windows
_cairo_utf8_to_utf16 is used by _cairo_fopen on Windows so must be
defined even if Win32 fonts or other features are disabled.

Fixes #381
2021-07-23 19:15:56 +09:30
Adrian Johnson
0f18a873ef PS: ensure setup DSC comments are in BeginSetup section
Fixes #411
2021-07-23 19:10:55 +09:30
Bryce Harrington
c91ae5c5a0 boilerplate: Use _cairo_malloc instead of malloc
This changes most instances of malloc() calls to use Cairo's safer
_cairo_malloc().  The malloc() call in the implementation of
boilerplate's xmalloc() is not changed since it already includes a
size=0 check.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2021-07-23 18:33:19 +09:30
Adrian Johnson
ae04679a08 truetype: check cmap size before allocating memory
Fixes #264
2021-07-23 18:32:44 +09:30
Uli Schlachter
e5e63a0462 Merge branch 'issue-399' into 'master'
cff: use correct size cast when decoding bytes to a signed int

Closes #399

See merge request cairo/cairo!204
2021-07-22 14:21:56 +00:00
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
Adrian Johnson
82f5570ad5 Merge branch 'issue-413' into 'master'
cff: Check subroutine number is valid before using as an array index

Closes #413

See merge request cairo/cairo!202
2021-07-20 22:41:43 +00:00
Jonathan Kew
a8238adc5a Add link with a negative coordinate to testcase. 2021-07-20 17:53:45 +01: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
08f2fb6b25 Merge branch 'type1-subset-fixes' into 'master'
Fix some type1-subset array indexing bugs

Closes #13 and #452

See merge request cairo/cairo!201
2021-07-20 11:35:02 +00:00
Adrian Johnson
7c803ceb19 Merge branch 'recording-surface-tags' into 'master'
Add an extra PDF link test to pdf-tagged-text testcase

See merge request cairo/cairo!194
2021-07-20 11:14:09 +00:00
Adrian Johnson
a623906bf9 Fix some type1-subset array indexing bugs
Fixes #13
Fixes #452
2021-07-20 08:22:55 +09:30
Jonathan Kew
84192695f8 Fix use-after-free in pdf-features testcase. 2021-07-19 12:30:17 +01:00
Jonathan Kew
20ef4ec460 Add an example of a link within an empty clip to pdf-tagged-text testcase. 2021-07-19 12:28:14 +01:00
Adrian Johnson
99d5337918 Merge branch 'ps-docs' into 'master'
Update DSC documention

Closes #380

See merge request cairo/cairo!200
2021-07-18 11:40:27 +00:00
Adrian Johnson
cb0bfefba2 Update DSC documention
Fixes #380
2021-07-18 19:30:48 +09:30
Adrian Johnson
2ffc209485 Merge branch 'dont-drop-tags' into 'master'
Remove all gstate from _cairo_surface_tag

See merge request cairo/cairo!196
2021-07-18 09:33:05 +00:00
Adrian Johnson
e73b4c799e Fix PS test crash
When the tests run ghostscipt on ps2 files it crashes with:

  Error: /undefined in .setlanguagelevel
  Operand stack:
     2
  Execution stack:
     %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
  Dictionary stack:
     --dict:732/1123(ro)(G)--   --dict:0/20(G)--   --dict:75/200(L)--
  Current allocation mode is local
  GPL Ghostscript 9.53.3: Unrecoverable error, exit code 1

The problem is the "-c 2 .setlanguagelevel -f" on the gs command line
to set ghostscript to language level 2. I'm not sure why this no longer works.

.setlanguagelevel is not mentioned any where in the gs custom operators listed in
https://www.ghostscript.com/doc/current/Language.htm

I assume this operator was meant for ghostscript internal use and
is no longer exposed in recent versions. Remove it from the test.
2021-07-18 18:13:10 +09:30
Adrian Johnson
26043a2db1 Fix crash 2021-07-18 18:13:10 +09:30
Adrian Johnson
81d7b2e3a4 test: add URL and "rect" attribute to pdf-tagged-text 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
ff2a95d6e5 Merge branch 'isxdigit' into 'master'
Create cairo version of isxdigit()

Closes #335

See merge request cairo/cairo!199
2021-07-18 07:31:16 +00:00
Adrian Johnson
30a0ae56d8 Create cairo version of isxdigit()
Fixes #335
2021-07-18 16:10:59 +09:30
Uli Schlachter
a6f7c20bef Merge branch 'windows-ci-fix' into 'master'
ci: add fallback_source_uri to work around ssl certificate issues on windows runners

See merge request cairo/cairo!198
2021-07-18 05:34:40 +00:00
Tim-Philipp Müller
b2a1525113 ci: add fallback_source_uri to work around ssl certificate issues on windows runners
Has to be fixed properly, possibly by regenerating the image, but
for now this might do the job.
2021-07-17 23:58:44 +01:00
Emmanuele Bassi
0eff09a1e3 Merge branch 'fix-fontconfig-subproject' into 'master'
Fix fontconfig subproject

See merge request cairo/cairo!193
2021-07-01 12:01:14 +00:00
Matthias Clasen
13660ff925 Fix fontconfig subproject
fontconfig has changed its default git branch from
master to main, and deleted the master branch. This
breaks GTK ci on MacOs, where we use build cairo and
use its fontconfig subproject.
2021-07-01 06:55:59 -04:00
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
Tim-Philipp Müller
716d144cbd Merge branch 'fix-meson-build' into 'master'
Fix the meson build

See merge request cairo/cairo!190
2021-06-18 13:09:54 +00:00
Uli Schlachter
edac5f66a0 Fix the meson build
I merged two MRs and broke the build:

- One MR added perf/ to the meson build
- The second MR changed lots of meson code to just dependency objects
  instead of just "messing" with include directories and library objects

The result was that perf/meson.build now referred to include objects and
library objects that no longer exist.

Fix this by also using dependency objects in perf/.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-06-17 17:03:10 +02:00
Uli Schlachter
dd1f8f00df Merge branch 'extra-test-steps' into 'master'
CI: Split test execution into per-backend jobs

See merge request cairo/cairo!188
2021-06-17 14:25:54 +00: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