Package: librsvg2-2
Version: 2.40.5-1
Severity: normal

The attached test program (compiled with gcc `pkg-config --cflags
--libs librsvg-2.0` test.c) gives a correct output (a rectangle
filling the upper left quadrant) when rendered with scale 2, and no
output with scale 1.

The bug seems to be triggered by the <path>, but affects the <rect>.
The radialGradient also seems necessary to trigger the bug.

The bug may be related to #764640, though this one happens always
AFAICT (and in jessie where I couldn't reproduce #764640).

-- System Information:
Debian Release: 8.2
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'proposed-updates'), (500, 
'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=de_DE, LC_CTYPE=de_DE (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages librsvg2-2 depends on:
ii  libc6                2.19-18+deb8u1
ii  libcairo2            1.14.0-2.1
ii  libcroco3            0.6.8-3+b1
ii  libgdk-pixbuf2.0-0   2.31.1-2+deb8u2
ii  libglib2.0-0         2.42.1-1
ii  libpango-1.0-0       1.36.8-3
ii  libpangocairo-1.0-0  1.36.8-3
ii  libxml2              2.9.1+dfsg1-5
ii  multiarch-support    2.19-18+deb8u1

Versions of packages librsvg2-2 recommends:
ii  librsvg2-common  2.40.5-1

Versions of packages librsvg2-2 suggests:
ii  librsvg2-bin  2.40.5-1

-- no debconf information
#include <string.h>
#include <stdio.h>
#include <librsvg/rsvg.h>

void test (const char *s, int scale)
{
  GError *e = NULL;
  RsvgHandle *r = rsvg_handle_new_from_data ((const unsigned char *) s, strlen (s), &e);
  int n = 10 * scale;
  cairo_surface_t *u = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, n, n);
  cairo_t *c = cairo_create (u);
  cairo_scale (c, scale, scale);
  rsvg_handle_render_cairo (r, c);
  unsigned char *d = cairo_image_surface_get_data (u);
  int i, j;
  for (j = 0; j < n; j++)
    {
      for (i = 0; i < n; i++)
        putchar (d[(j * n + i) * 4] ? '*' : '.');
      putchar ('\n');
    }
  cairo_destroy (c);
  cairo_surface_destroy (u);
  g_object_unref (r);
}

const char *svg =
  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
  "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 20001102//EN\" \"http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd\";>"
  "<svg width=\"10\" height=\"10\">"
  "<defs>"
  "<radialGradient id=\"g1\">"
  "<stop offset=\"0\" style=\"stop-color:red\"/>"
  "<stop offset=\"1\" style=\"stop-color:green\"/>"
  "</radialGradient>"
  "</defs>"
  "<path d=\"m0,0 c0.5,0 0,1 -1,1\" fill=\"url(#g1)\"/>"
  "<rect width=\"5\" height=\"5\" fill=\"white\"/>"
  "</svg>";

int main ()
{
  printf ("Scale 1, wrong:\n");
  test (svg, 1);
  printf ("\nScale 2, OK:\n");
  test (svg, 2);
}

Reply via email to