Re: Segfault on _pygi_marshal_to_py_array()



Hi,

On Sun, Nov 3, 2013 at 8:39 AM, Adrian Pardini <listas tangopardo com ar> wrote:
Hi all, I'm tracing an issue with Clutter.Stage.read_pixels().
In line 308 of gi/pygi-marshal-to-py.c we do:
    GIArgument *len_arg = state->args[seq_cache->len_arg_index];

len_arg then points to an invalid location and so the following call
to gi_argument_to_gsize() segfaults.

This API is basically not binding friendly as it needs to return a
buffer length. The Python bindings should handle this a little better
(raise an exception instead of a segfault). But the API should also be
marked as "skipped" so it is not even accessible.

Besides checking that len_arg_index is a valid value the annotation
should be fixed and I'm not sure about how to do that. The size in
bytes can be computed as 4*(width-x)*(height-y) so perhaps making
another function that wraps the original and also returns the size is
the way to go. I'll bring that discussion to the clutter list but I'd
like to hear your opinions.

A quick search in bugzilla reveals clutter_stage_read_pixels is being
deprecated and clutter_stage_read_pixels_async will replace it. There
are patches on the ticket that look binding friendly and I'm sure the
devs would appreciate some testing and reporting:

https://bugzilla.gnome.org/show_bug.cgi?id=653590

-Simon


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]