Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 750239 - x11-themes/adwaita-icon-theme-3.36.1 - (gtk-encode-symbolic-svg:32149): GLib-ERROR **: ../glib-2.64.5/glib/gmem.c:173: failed to allocate 2147483648 bytes
Summary: x11-themes/adwaita-icon-theme-3.36.1 - (gtk-encode-symbolic-svg:32149): GLib-...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: PPC Linux
: Normal normal (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL: https://gitlab.gnome.org/GNOME/librsv...
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2020-10-19 19:09 UTC by ernsteiswuerfel
Modified: 2021-11-27 22:48 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (adwaita-icon-theme-3.36.1:20201019-124039.log,738.02 KB, text/plain)
2020-10-19 19:09 UTC, ernsteiswuerfel
Details
emerge --info (file_750239.txt,5.96 KB, text/plain)
2020-10-19 19:09 UTC, ernsteiswuerfel
Details
output of 'coredumctl gdb' (coredumpctl_gdb_output.txt,4.89 KB, text/plain)
2020-10-19 19:11 UTC, ernsteiswuerfel
Details
librsvg-2.40.21-uninit.patch (librsvg-2.40.21-uninit.patch,457 bytes, patch)
2020-11-11 22:22 UTC, Sergei Trofimovich (RETIRED)
Details | Diff
Patch to fix arc flag parsing (arcflags.diff,847 bytes, patch)
2021-11-27 22:48 UTC, Adam Sampson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ernsteiswuerfel archtester 2020-10-19 19:09:33 UTC
Created attachment 667184 [details]
build.log

Build phase works fine on ppc but during install phase I get lots of these "(gtk-encode-symbolic-svg:32149): GLib-ERROR **: ../glib-2.64.5/glib/gmem.c:173: failed to allocate 2147483648 bytes" messages.

This happened so far on my ppc build only. amd64, x86, ppc64 were fine. Don't know whether other non-x86 archs would be affected.

[...]
(gtk-encode-symbolic-svg:32149): GLib-ERROR **: 20:24:15.624: ../glib-2.64.5/glib/gmem.c:173: failed to allocate 2147483648 bytes
/bin/sh: line 4: 32149 Trace/breakpoint trap   (core dumped) /usr/bin/gtk-encode-symbolic-svg ../../Adwaita/scalable/$file $size -o /var/tmp/portage/x11-themes/adwaita-icon-theme-3.36.1/image//usr/share/icons/Adwaita/$size/$context
make[3]: *** [Makefile:447: install-data-local] Error 133
make[3]: Leaving directory '/var/tmp/portage/x11-themes/adwaita-icon-theme-3.36.1/work/adwaita-icon-theme-3.36.1/src/symbolic'
make[2]: *** [Makefile:313: install-am] Error 2
make[2]: Leaving directory '/var/tmp/portage/x11-themes/adwaita-icon-theme-3.36.1/work/adwaita-icon-theme-3.36.1/src/symbolic'
make[1]: *** [Makefile:323: install-recursive] Error 1
make[1]: Leaving directory '/var/tmp/portage/x11-themes/adwaita-icon-theme-3.36.1/work/adwaita-icon-theme-3.36.1/src'
make: *** [Makefile:535: install-recursive] Error 1
 * ERROR: x11-themes/adwaita-icon-theme-3.36.1::gentoo failed (install phase):
 *   emake failed

Built a few packages with debug flags to get a proper stacktrace out of coredumpctl:

[..]
#0  0x00000000f7bddf20 __libc_signal_restore_set (libc.so.6 + 0x3bf20)
#1  0x00000000f7dc9e1c _g_log_abort (libglib-2.0.so.0 + 0x53e1c)
#2  0x00000000f7dcacd4 g_log_default_handler (libglib-2.0.so.0 + 0x54cd4)
#3  0x00000000f7dcaf60 g_logv (libglib-2.0.so.0 + 0x54f60)
#4  0x00000000f7dcb0a4 g_log (libglib-2.0.so.0 + 0x550a4)
#5  0x00000000f7dc98b0 g_realloc (libglib-2.0.so.0 + 0x538b0)
#6  0x00000000f7d97188 g_array_maybe_expand (libglib-2.0.so.0 + 0x21188)
#7  0x00000000f7d976a0 g_array_append_vals (libglib-2.0.so.0 + 0x216a0)
#8  0x00000000f68f7b7c rsvg_path_builder_add_element (librsvg-2.so.2 + 0xcb7c)
#9  0x00000000f68f7d7c rsvg_path_builder_curve_to (librsvg-2.so.2 + 0xcd7c)
#10 0x00000000f68f8328 rsvg_path_arc_segment (librsvg-2.so.2 + 0xd328)
#11 0x00000000f68f8704 rsvg_parse_path_do_cmd (librsvg-2.so.2 + 0xd704)
#12 0x00000000f68f8c08 rsvg_parse_path_data (librsvg-2.so.2 + 0xdc08)
#13 0x00000000f6905b24 rsvg_node_path_set_atts (librsvg-2.so.2 + 0x1ab24)
#14 0x00000000f690e14c rsvg_node_set_atts (librsvg-2.so.2 + 0x2314c)
#15 0x00000000f690e1d4 rsvg_standard_element_start (librsvg-2.so.2 + 0x231d4)
#16 0x00000000f6910564 rsvg_start_element (librsvg-2.so.2 + 0x25564)
#17 0x00000000f677b158 xmlParseStartTag__internal_alias (libxml2.so.2 + 0x43158)
#18 0x00000000f6780394 xmlParseTryOrFinish (libxml2.so.2 + 0x48394)
#19 0x00000000f678177c xmlParseChunk__internal_alias (libxml2.so.2 + 0x4977c)
#20 0x00000000f690f7ec rsvg_handle_write_impl (librsvg-2.so.2 + 0x247ec)
#21 0x00000000f6950968 gdk_pixbuf__svg_image_load_increment (libpixbufloader-svg.so + 0x968)
#22 0x00000000003cc5ec gdk_pixbuf_loader_load_module (libgdk_pixbuf-2.0.so.0 + 0xf5ec)
#23 0x00000000003cce7c gdk_pixbuf_loader_close (libgdk_pixbuf-2.0.so.0 + 0xfe7c)
#24 0x00000000003c9970 load_from_stream (libgdk_pixbuf-2.0.so.0 + 0xc970)
#25 0x00000000003ca798 gdk_pixbuf_new_from_stream (libgdk_pixbuf-2.0.so.0 + 0xd798)
#26 0x000000000053a0b0 load_symbolic_svg (gtk-encode-symbolic-svg + 0x10b0)
#27 0x00000000f7bc3fe0 generic_start_main (libc.so.6 + 0x21fe0)
#28 0x00000000f7bc4180 __libc_start_main (libc.so.6 + 0x22180)

Following versions installed:
dev-libs/glib-2.64.5:2::gentoo  USE="dbus debug (mime) static-libs xattr -fam -gtk-doc (-selinux) -systemtap -test -utils" 0 KiB
dev-libs/libxml2-2.9.10-r3:2::gentoo  USE="debug icu ipv6 python readline static-libs -examples -lzma -test" PYTHON_TARGETS="python3_7 python3_8 -python3_6 (-python3_9)" 0 KiB
x11-libs/gdk-pixbuf-2.40.0:2::gentoo  USE="X introspection jpeg tiff -gtk-doc" 0 KiB
gnome-base/librsvg-2.40.21:2::gentoo  USE="introspection vala -tools" 0 KiB
x11-libs/gtk+-3.24.22:3::gentoo  USE="X colord introspection (-aqua) -broadway -cloudprint -cups -examples -gtk-doc -test -vim-syntax -wayland -xinerama" 0 KiB
Comment 1 ernsteiswuerfel archtester 2020-10-19 19:09:53 UTC
Created attachment 667187 [details]
emerge --info
Comment 2 ernsteiswuerfel archtester 2020-10-19 19:11:52 UTC
Created attachment 667190 [details]
output of 'coredumctl gdb'
Comment 3 ernsteiswuerfel archtester 2020-11-10 13:48:32 UTC
Despite adwaita-icon-theme-3.36.1 being stable now I still can't build it due to this bug.
Comment 4 ernsteiswuerfel archtester 2020-11-10 22:09:35 UTC
adwaita-icon-theme-3.36.1 builds without errors when using gnome-base/librsvg-2.48.8.

This however needs ppc keywords:
=gnome-base/librsvg-2.48.8 **
=dev-lang/rust-bin-1.46.0 **
=virtual/rust-1.46.0 **
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2020-11-11 09:40:20 UTC
On ppc valgrind detects a bunch of uninitialized data being used:

==32145== Conditional jump or move depends on uninitialised value(s)
==32145==    at 0x660C350: rsvg_path_builder_arc (rsvg-path.c:273)
==32145==    by 0x660C8D7: rsvg_parse_path_do_cmd (rsvg-path.c:535)
==32145==    by 0x660D74B: rsvg_parse_path_data (rsvg-path.c:728)
==32145==    by 0x660D74B: rsvg_parse_path (rsvg-path.c:750)
==32145==    by 0x661E013: rsvg_node_path_set_atts (rsvg-shapes.c:76)
==32145==    by 0x661E013: rsvg_node_path_set_atts (rsvg-shapes.c:67)
==32145==    by 0x66277A3: rsvg_node_set_atts (rsvg-base.c:2191)
==32145==    by 0x66277A3: rsvg_standard_element_start (rsvg-base.c:331)
==32145==    by 0x662B85F: rsvg_start_element (rsvg-base.c:761)
==32145==    by 0x670A2E7: xmlParseStartTag (in /usr/lib/libxml2.so.2.9.10)
==32145==    by 0x67123EF: ??? (in /usr/lib/libxml2.so.2.9.10)
==32145==    by 0x671342B: xmlParseChunk (in /usr/lib/libxml2.so.2.9.10)
==32145==    by 0x662A51F: rsvg_handle_write_impl (rsvg-base.c:1229)
==32145==    by 0x65CD98F: gdk_pixbuf__svg_image_load_increment (io-svg.c:133)
==32145==    by 0x4955A77: ??? (in /usr/lib/libgdk_pixbuf-2.0.so.0.4000.0)
==32145==    by 0x4956773: gdk_pixbuf_loader_close (in /usr/lib/libgdk_pixbuf-2.0.so.0.4000.0)
==32145==    by 0x4951DDB: ??? (in /usr/lib/libgdk_pixbuf-2.0.so.0.4000.0)
==32145==    by 0x49531D3: gdk_pixbuf_new_from_stream (in /usr/lib/libgdk_pixbuf-2.0.so.0.4000.0)
==32145==    by 0x10910B: ??? (in /usr/bin/gtk-encode-symbolic-svg)
==32145==    by 0x4E4B55F: (below main) (libc-start.c:314)
==32145==  Uninitialised value was created by a stack allocation
==32145==    at 0x660CE9C: rsvg_parse_path (rsvg-path.c:738)
...
==32145== Use of uninitialised value of size 4
==32145==    at 0x5712CEC: __sqrt_finite@GLIBC_2.15 (e_sqrt.c:87)
==32145==    by 0x56DCBDB: sqrt (w_sqrt_compat.c:34)
==32145==    by 0x660C3C7: rsvg_path_builder_arc (rsvg-path.c:284)
==32145==    by 0x660C8D7: rsvg_parse_path_do_cmd (rsvg-path.c:535)
==32145==    by 0x660D74B: rsvg_parse_path_data (rsvg-path.c:728)
==32145==    by 0x660D74B: rsvg_parse_path (rsvg-path.c:750)
==32145==    by 0x661E013: rsvg_node_path_set_atts (rsvg-shapes.c:76)
==32145==    by 0x661E013: rsvg_node_path_set_atts (rsvg-shapes.c:67)
==32145==    by 0x66277A3: rsvg_node_set_atts (rsvg-base.c:2191)
==32145==    by 0x66277A3: rsvg_standard_element_start (rsvg-base.c:331)
==32145==    by 0x662B85F: rsvg_start_element (rsvg-base.c:761)
==32145==    by 0x670A2E7: xmlParseStartTag (in /usr/lib/libxml2.so.2.9.10)
==32145==    by 0x67123EF: ??? (in /usr/lib/libxml2.so.2.9.10)
==32145==    by 0x671342B: xmlParseChunk (in /usr/lib/libxml2.so.2.9.10)
==32145==    by 0x662A51F: rsvg_handle_write_impl (rsvg-base.c:1229)
==32145==    by 0x65CD98F: gdk_pixbuf__svg_image_load_increment (io-svg.c:133)
==32145==    by 0x4955A77: ??? (in /usr/lib/libgdk_pixbuf-2.0.so.0.4000.0)
==32145==    by 0x4956773: gdk_pixbuf_loader_close (in /usr/lib/libgdk_pixbuf-2.0.so.0.4000.0)
==32145==    by 0x4951DDB: ??? (in /usr/lib/libgdk_pixbuf-2.0.so.0.4000.0)
==32145==    by 0x49531D3: gdk_pixbuf_new_from_stream (in /usr/lib/libgdk_pixbuf-2.0.so.0.4000.0)
==32145==    by 0x10910B: ??? (in /usr/bin/gtk-encode-symbolic-svg)
==32145==    by 0x4E4B55F: (below main) (libc-start.c:314)
==32145==  Uninitialised value was created by a stack allocation
==32145==    at 0x660CE9C: rsvg_parse_path (rsvg-path.c:738)

It might not be the primary reason to get garbage 2147483648 (0x80000000) value into 'malloc()', but fixing it might make real error more clear.
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2020-11-11 22:22:03 UTC
Created attachment 670966 [details, diff]
librsvg-2.40.21-uninit.patch

Do you want to give patch a try?

librsvg-2.40.21-uninit.patch fixes both use of uninitialized value and crash on ppc.
Comment 7 ernsteiswuerfel archtester 2020-11-12 11:06:35 UTC
Thank you for the patch slyfox!

After applying it to librsvg-2.40.21, adwaita-icon-theme-3.36.1 builds fine now without errors.
Comment 8 spock128 2020-11-15 19:22:14 UTC
I was seeing the same issue building adwaita-icon-theme-3.36.1 for sparc (failed to allocate 2147483648 bytes). Applying the suggested patch to librsvg-2.40.21 fixed it.
Comment 9 Larry the Git Cow gentoo-dev 2020-11-28 17:01:43 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=01a52e7c4a0be5d3131ca47ea0722b31d5d8958d

commit 01a52e7c4a0be5d3131ca47ea0722b31d5d8958d
Author:     Matt Turner <mattst88@gentoo.org>
AuthorDate: 2020-11-28 16:57:51 +0000
Commit:     Matt Turner <mattst88@gentoo.org>
CommitDate: 2020-11-28 17:01:31 +0000

    x11-themes/adwaita-icon-theme: Depend on new enough librsvg
    
    adwaita-icon-theme now uses SVG features only available in the Rust
    version of librsvg (newer than 2.40). The suspicion is that the
    uninitialized reads in bug #750239 are due to the missing functionality
    in librsvg 2.40.
    
    See https://gitlab.gnome.org/GNOME/librsvg/-/issues/654#note_972787
    and https://people.gnome.org/~federico/blog/do-not-use-librsvg-2.40.x.html
    
    Closes: https://bugs.gentoo.org/750239
    Signed-off-by: Matt Turner <mattst88@gentoo.org>

 ...ita-icon-theme-3.36.1.ebuild => adwaita-icon-theme-3.36.1-r1.ebuild} | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-12-06 14:03:56 UTC
Shall we just shove the patch in for other arches for now?
Comment 11 ernsteiswuerfel archtester 2020-12-06 21:28:25 UTC
I think the patch is a 'good enough' solution as the alternative would be to keyword/stable rust-bin for all arches where x11-themes/adwaita-icon-theme is keyworded or to drop all adwaita-icon-theme rdeps alltogether on these arches, which would be alpha/hppa/ia64/ppc/sparc.
Comment 12 Matt Turner gentoo-dev 2020-12-06 22:56:29 UTC
(In reply to ernsteiswuerfel from comment #11)
> I think the patch is a 'good enough' solution as the alternative would be to
> keyword/stable rust-bin for all arches where x11-themes/adwaita-icon-theme
> is keyworded or to drop all adwaita-icon-theme rdeps alltogether on these
> arches, which would be alpha/hppa/ia64/ppc/sparc.

Packages use the SVG files provided by adwaita-icon-theme directly, and that requires the new librsvg. There's not really anything that we can do.
Comment 13 Johannes Kalliauer 2021-05-14 18:28:37 UTC
I'm not shure if the upstream-workaround helps. If you can pre-process the svgs with https://svgworkaroundbot.toolforge.org/ , or more precisely with https://github.com/RazrFalcon/svgcleaner you might can solve the issue. If you do not safe the svg, you could use https://github.com/RazrFalcon/resvg/tree/master/usvg that produces mirkro-svgs that are easy to render by any library that does support only basic svg-features.
Comment 14 Adam Sampson 2021-11-27 22:48:01 UTC
Created attachment 756770 [details, diff]
Patch to fix arc flag parsing

I ran into the problem with librsvg-2.40 not rendering the Adwaita SVG icons correctly for a different distribution. arcflags.diff appears to fix the problem from the parsing end, although keeping the other patch to initialise the params to 0 is a good idea as well (I think the rendering code is missing a case for this for arcs).