Repost [PATCH cairo-www] Missing argument defs cause segfaults

Submitted by Lawrence D'Oliveiro on May 17, 2017, 4:59 a.m.

Details

Message ID 20170517165943.3a1d152c@theon.geek-central.gen.nz
State New
Series "Repost [PATCH cairo-www] Missing argument defs cause segfaults"
Headers show

Commit Message

Lawrence D'Oliveiro May 17, 2017, 4:59 a.m.
The cookbook example of how to call FreeType using ctypes is missing
the argtypes definition for cairo_font_face_get_user_data. This will
cause segfaults.

Enclosed is a fix.

Patch hide | download patch | download mbox

commit 03559f851898195868cf218905129000c5ca8d16
Author: Lawrence D'Oliveiro <ldo@geek-central.gen.nz>
Date:   Wed Apr 19 01:20:03 2017 +0000

    missing argument defs cause segfault

diff --git a/src/cookbook/freetypepython.mdwn b/src/cookbook/freetypepython.mdwn
index 5aea77f..83f71d5 100644
--- a/src/cookbook/freetypepython.mdwn
+++ b/src/cookbook/freetypepython.mdwn
@@ -32,6 +32,7 @@  The resulting cairo font face however can be used normally with pycairo.
 			_cairo_so.cairo_ft_font_face_create_for_ft_face.restype = ct.c_void_p
 			_cairo_so.cairo_ft_font_face_create_for_ft_face.argtypes = [ ct.c_void_p, ct.c_int ]
 			_cairo_so.cairo_font_face_get_user_data.restype = ct.c_void_p
+			_cairo_so.cairo_font_face_get_user_data.argtypes = (ct.c_void_p, ct.c_void_p)
 			_cairo_so.cairo_font_face_set_user_data.argtypes = (ct.c_void_p, ct.c_void_p, ct.c_void_p, ct.c_void_p)
 			_cairo_so.cairo_set_font_face.argtypes = [ ct.c_void_p, ct.c_void_p ]
 			_cairo_so.cairo_font_face_status.argtypes = [ ct.c_void_p ]

Comments

Bryce Harrington June 7, 2017, 12:54 a.m.
On Wed, May 17, 2017 at 04:59:43PM +1200, Lawrence D'Oliveiro wrote:
> The cookbook example of how to call FreeType using ctypes is missing
> the argtypes definition for cairo_font_face_get_user_data. This will
> cause segfaults.
> 
> Enclosed is a fix.

Thanks, pushed:
To git+ssh://cairographics.org/git/cairo-www
   b4b4640..a36e943  master -> master

> commit 03559f851898195868cf218905129000c5ca8d16
> Author: Lawrence D'Oliveiro <ldo@geek-central.gen.nz>
> Date:   Wed Apr 19 01:20:03 2017 +0000
> 
>     missing argument defs cause segfault
> 
> diff --git a/src/cookbook/freetypepython.mdwn b/src/cookbook/freetypepython.mdwn
> index 5aea77f..83f71d5 100644
> --- a/src/cookbook/freetypepython.mdwn
> +++ b/src/cookbook/freetypepython.mdwn
> @@ -32,6 +32,7 @@ The resulting cairo font face however can be used normally with pycairo.
>  			_cairo_so.cairo_ft_font_face_create_for_ft_face.restype = ct.c_void_p
>  			_cairo_so.cairo_ft_font_face_create_for_ft_face.argtypes = [ ct.c_void_p, ct.c_int ]
>  			_cairo_so.cairo_font_face_get_user_data.restype = ct.c_void_p
> +			_cairo_so.cairo_font_face_get_user_data.argtypes = (ct.c_void_p, ct.c_void_p)
>  			_cairo_so.cairo_font_face_set_user_data.argtypes = (ct.c_void_p, ct.c_void_p, ct.c_void_p, ct.c_void_p)
>  			_cairo_so.cairo_set_font_face.argtypes = [ ct.c_void_p, ct.c_void_p ]
>  			_cairo_so.cairo_font_face_status.argtypes = [ ct.c_void_p ]

> -- 
> cairo mailing list
> cairo@cairographics.org
> https://lists.cairographics.org/mailman/listinfo/cairo