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>
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>
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>
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.
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.
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>
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>
This allows tests xcb-surface-source and xlib-surface-source to run.
Somehow I thought this would be more complicated...
Signed-off-by: Uli Schlachter <psychon@znc.in>
This creates one job per cairo backend that is tested on CI. That
backend is then tested in its own job.
One motivation is that this will hopefully be faster, because tests are
run in parallel. Another motivation is that this lets us get around the
one hour time limit per job.
A downside is that the inter-backend tests are not run in CI. For
example, xlib-surface-source requires a working X11 server. I am not
providing that X11 server here.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Having comma separated lists of test names that we expect to fail leads
to really unreadable and useless diffs. Thus, this commit changes these
lists to be separated by newlines. This change was generated with:
( cd .gitlab-ci ; for x in * ; do tr ',' '\n' < $x > .$x ; mv .$x $x ; done )
The code in .gitlab-ci.yml is changed to use tr again to transfer these
lists back so that everything still works.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Because shell variables cannot contain &, this character was replaced
with an underscore in the shell variable. However, we can have this
character just fine in the file name. Thus, this commits renames a file
to actually include the proper name of the boilerplate target, which is
xcb-window&.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Before this commit, .gitlab-ci.yml is way too large, because it contains
the list with all the expected test failure. This commit moves those
lists to extra files.
The files were generated with a shell one-liner:
grep CAIRO_TEST_IGNORE .gitlab-ci.yml | while read line ; do
backend=$(echo $line | cut -f 3 -d ' ' | cut -f1 -d= | sed -e
's/CAIRO_TEST_IGNORE_//;s/_/-/g') ; content=$(echo $line | cut -f2-
-d=) ; echo $backend ; echo $content >
.gitlab-ci/ignore-${backend}.txt ; done
The changes to .gitlab-ci.yml were also generated with some shell
scripting that generates a sed argument:
grep CAIRO_TEST_IGNORE .gitlab-ci.yml | while read line ; do
backend=$(echo $line | cut -f 3 -d ' ' | cut -f1 -d= ) ; file=$(echo
$backend | sed -e 's/CAIRO_TEST_IGNORE_//;s/_/-/g') ; printf
"/$backend/s#=.*#=\$(cat .gitlab-ci/ignore-${file}.txt)#;"; done ;
echo
The above can then be applied via (but of course adding ' around it and
I also left out the final ;):
sed -i -e [the output of the above] .gitlab-ci.yml
Just for completeness, [the output of the above] is:
/CAIRO_TEST_IGNORE_pdf_argb32/s#=.*#=$(cat
.gitlab-ci/ignore-pdf-argb32.txt)#;/CAIRO_TEST_IGNORE_pdf_rgb24/s#=.*#=$(cat
.gitlab-ci/ignore-pdf-rgb24.txt)#;/CAIRO_TEST_IGNORE_script_argb32/s#=.*#=$(cat
.gitlab-ci/ignore-script-argb32.txt)#;/CAIRO_TEST_IGNORE_image_argb32/s#=.*#=$(cat
.gitlab-ci/ignore-image-argb32.txt)#;/CAIRO_TEST_IGNORE_image_rgb24/s#=.*#=$(cat
.gitlab-ci/ignore-image-rgb24.txt)#;/CAIRO_TEST_IGNORE_image16_rgb24/s#=.*#=$(cat
.gitlab-ci/ignore-image16-rgb24.txt)#;/CAIRO_TEST_IGNORE_recording_argb32/s#=.*#=$(cat
.gitlab-ci/ignore-recording-argb32.txt)#;/CAIRO_TEST_IGNORE_recording_rgb24/s#=.*#=$(cat
.gitlab-ci/ignore-recording-rgb24.txt)#;/CAIRO_TEST_IGNORE_svg11_argb32/s#=.*#=$(cat
.gitlab-ci/ignore-svg11-argb32.txt)#;/CAIRO_TEST_IGNORE_svg11_rgb24/s#=.*#=$(cat
.gitlab-ci/ignore-svg11-rgb24.txt)#;/CAIRO_TEST_IGNORE_xcb_argb32/s#=.*#=$(cat
.gitlab-ci/ignore-xcb-argb32.txt)#;/CAIRO_TEST_IGNORE_xcb_rgb24/s#=.*#=$(cat
.gitlab-ci/ignore-xcb-rgb24.txt)#;/CAIRO_TEST_IGNORE_xcb_window_rgb24/s#=.*#=$(cat
.gitlab-ci/ignore-xcb-window-rgb24.txt)#;/CAIRO_TEST_IGNORE_xcb_window__rgb24/s#=.*#=$(cat
.gitlab-ci/ignore-xcb-window--rgb24.txt)#;/CAIRO_TEST_IGNORE_xcb_render_0_0_argb32/s#=.*#=$(cat
.gitlab-ci/ignore-xcb-render-0-0-argb32.txt)#;/CAIRO_TEST_IGNORE_xcb_render_0_0_rgb24/s#=.*#=$(cat
.gitlab-ci/ignore-xcb-render-0-0-rgb24.txt)#;/CAIRO_TEST_IGNORE_xcb_fallback_rgb24/s#=.*#=$(cat
.gitlab-ci/ignore-xcb-fallback-rgb24.txt)#;/CAIRO_TEST_IGNORE_xlib_argb32/s#=.*#=$(cat
.gitlab-ci/ignore-xlib-argb32.txt)#;/CAIRO_TEST_IGNORE_xlib_rgb24/s#=.*#=$(cat
.gitlab-ci/ignore-xlib-rgb24.txt)#;/CAIRO_TEST_IGNORE_xlib_window_rgb24/s#=.*#=$(cat
.gitlab-ci/ignore-xlib-window-rgb24.txt)#;/CAIRO_TEST_IGNORE_xlib_render_0_0_rgb24/s#=.*#=$(cat
.gitlab-ci/ignore-xlib-render-0-0-rgb24.txt)#;/CAIRO_TEST_IGNORE_xlib_fallback_rgb24/s#=.*#=$(cat
.gitlab-ci/ignore-xlib-fallback-rgb24.txt)#;/CAIRO_TEST_IGNORE_quartz_argb32/s#=.*#=$(cat
.gitlab-ci/ignore-quartz-argb32.txt)#;/CAIRO_TEST_IGNORE_quartz_rgb24/s#=.*#=$(cat
.gitlab-ci/ignore-quartz-rgb24.txt)#;
(All line breaks are only added for readability and are not part of the
one-liners)
Signed-off-by: Uli Schlachter <psychon@znc.in>