Bug 8102

Summary: context.push_group() crashes when floating point transformation exists
Product: pycairo Reporter: Niklas Volbers <mithrandir42>
Component: generalAssignee: Steve Chaplin <d74n5pohf9>
Status: RESOLVED NOTOURBUG QA Contact:
Severity: major    
Priority: high CC: mithrandir42
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Niklas Volbers 2006-09-01 14:11:04 UTC
The context.push_group() method will cause a segmentation fault if 
(a) a transformation has been defined with a floating point number as argument
(b) a rectangular clipping region is defined using context.rectangle(...) and
context.clip()
(c) the context.push_group() method is called.

The following snippet, which is a variation of the example on the pycairo
homepage, illustrates the bug:


-------
#!/usr/bin/env python

import cairo

WIDTH, HEIGHT = 400, 400

# Setup Cairo
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, WIDTH, HEIGHT)
ctx = cairo.Context(surface)

# Set thickness of brush
ctx.set_line_width(15)

if 1: # set to 0 or just plain 42 as scaling factor and the segault will go away !
    ctx.translate(100, 42.4344454647)
ctx.rectangle(0, 0, WIDTH, HEIGHT)
ctx.clip()
ctx.push_group()

# Draw out the triangle using absolute coordinates
ctx.move_to(200, 100)
ctx.line_to(300, 300)
ctx.rel_line_to(-200, 0)
ctx.close_path()

ctx.pop_group()

# Apply the ink
ctx.stroke()

# Output a PNG file
surface.write_to_png("triangle.png")

----

(I marked the bug as major, because I think a segfault is a major bug).
Comment 1 Steve Chaplin 2006-09-01 22:04:10 UTC
I created the equivalent C cairo program and the segmentation fault occurs when
using cairo without pycairo. So the bug is in cairo not pycairo.
See the cairo bug report
    https://bugs.freedesktop.org/show_bug.cgi?id=8106

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.