[perl-Glib-Object-Introspection/ppc64-fixes: 5/6] Fix a marshalling bug with Perl code and array args



commit 006c138541147f12a930b75375dc48d6f735e774
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Sun Sep 7 19:01:02 2014 +0200

    Fix a marshalling bug with Perl code and array args
    
    When invoking Perl code with array args, use the correct type for the length
    arg.  Previously, we used the type of the array arg to convert the length arg
    to a Perl value.  That is, in the most common case, we treated an integer as a
    pointer.  This works OK on little-endian systems, but most likely breaks on
    big-endian ones.

 gperl-i11n-invoke-perl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gperl-i11n-invoke-perl.c b/gperl-i11n-invoke-perl.c
index 49c855f..a266c7b 100644
--- a/gperl-i11n-invoke-perl.c
+++ b/gperl-i11n-invoke-perl.c
@@ -359,7 +359,7 @@ _prepare_perl_invocation_info (GPerlI11nPerlInvocationInfo *iinfo,
                if (arg_tag == GI_TYPE_TAG_ARRAY) {
                        gint pos = g_type_info_get_array_length (arg_type);
                        if (pos >= 0) {
-                               GITypeInfo *length_arg_type = iinfo->base.arg_types[i];
+                               GITypeInfo *length_arg_type = iinfo->base.arg_types[pos];
                                raw_to_arg (args[pos], &iinfo->base.aux_args[pos], length_arg_type);
                                dwarn ("  pos %d is array length => %"G_GSIZE_FORMAT"\n",
                                       pos, iinfo->aux_args[pos].v_size);


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