Subject: bug#64908: 29.1; svg parse failure

From: David Ponce <[email-masked]>
Date: Sat, 5 Aug 2023 18:24:43 +0200

On 05/08/2023 18:02, Alan Third wrote:
[...]
> Is your Emacs background black?
> 
> It sounds like rsvg_handle_get_geometry_for_layer is working, but
> something else is going wrong...
> 
> If you're able to use a debugger (I think you already did earlier in
> this thread) can you check the values of zero_rect, viewbox and
> out_logical_rect after rsvg_handle_get_geometry_for_layer has run?
> 

I am running "emacs -Q" configured with below options:

In GNU Emacs 30.0.50 (build 5, x86_64-pc-linux-gnu, GTK+ Version
  3.24.38, cairo version 1.17.8) of 2023-08-05 built on kilauea
Repository revision: 9026990c6685e87c328f4fcc575ef644c2f5595a
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12014000
System Description: Fedora Linux 38 (KDE Plasma)

Configured using:
  'configure --prefix=/home/dponce --with-x-toolkit=gtk3
  --with-native-compilation=no
  PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Background is white by default.

In *scratch* buffer I eval:

(insert-image '(image :type svg :data
      "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\">
   <defs id=\"defs3051\">
     <style type=\"text/css\" id=\"current-color-scheme\">
       .ColorScheme-Text {
         color:#232629;
       }
       </style>
   </defs>
  <path
     style=\"fill:currentColor;fill-opacity:1;stroke:none\"
     d=\"m7.707031 3l-.707031.707031 6.125 6.125 1.167969 1.167969-1.167969 1.167969-6.125 6.125.707031.707031 6.125-6.125 1.875-1.875-1.875-1.875-6.125-6.125\"
     class=\"ColorScheme-Text\"
     />
</svg>"
      :scale 1 :width 22 :height 22))

Just before call rsvg_handle_get_geometry_for_layer (line 11412 in image.c):

(gdb) print zero_rect
$1 = {x = 6.9533474147268633e-310, y = 2.4608421688060808e-319, width = 5.8283471538673388e-315, height = 9.8813129168249309e-323}
(gdb) print viewbox
$2 = {x = 6.9533558057749482e-310, y = 6.9533473517748961e-310, width = 1.4821969375237396e-323, height = 3.0586981611317814e-317}
(gdb) print out_logical_rect
$3 = {x = 1.2476920383715837e-316, y = 0, width = 0, height = 3.3675983782902914e-317}

Just after:

(gdb) print zero_rect
$4 = {x = 6.9533474147268633e-310, y = 2.4608421688060808e-319, width = 5.8283471538673388e-315, height = 9.8813129168249309e-323}
(gdb) print viewbox
$5 = {x = 0, y = 0, width = 0, height = 0}
(gdb) print out_logical_rect
$6 = {x = 0, y = 0, width = 0, height = 0}
(gdb) print $eax
$7 = 1

I attached a screenshot of the result.