[libglib-object-introspection-perl] 01/03: Fix a stack handling bug for Perl vfuncs

Intrigeri intrigeri at moszumanska.debian.org
Fri Aug 29 21:57:46 UTC 2014


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to annotated tag rel-0-02-4
in repository libglib-object-introspection-perl.

commit 0095be2381c4ad888e6ef61098710dee2f411d3c
Author: Torsten Schönfeld <kaffeetisch at gmx.de>
Date:   Wed Jun 25 22:44:52 2014 +0200

    Fix a stack handling bug for Perl vfuncs
    
    When there is a Perl implementation for a vfunc, invoking a C function that
    invokes this vfunc might end up reallocating the Perl stack and hence
    invalidating the local 'sp' pointer.  Fix with a pair of PUTBACK/SPAGAIN.
    
    Triggered by Gtk3's test suite.
---
 NEWS                  | 1 +
 gperl-i11n-invoke-c.c | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/NEWS b/NEWS
index 9d7f707..95b0f1f 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ Overview of changes in Glib::Object::Introspection 0.023
 ========================================================
 
 * Fix return value handling on big-endian architectures.
+* Fix a stack handling bug for Perl vfuncs.
 
 Overview of changes in Glib::Object::Introspection 0.022
 ========================================================
diff --git a/gperl-i11n-invoke-c.c b/gperl-i11n-invoke-c.c
index 1b00543..1497836 100644
--- a/gperl-i11n-invoke-c.c
+++ b/gperl-i11n-invoke-c.c
@@ -198,7 +198,12 @@ invoke_c_code (GICallableInfo *info,
 	return_value_p = &return_value;
 #endif
 
+	/* Wrap the call in PUTBACK/SPAGAIN because the C function might end up
+	 * calling Perl code (via a vfunc), which might reallocate the stack
+	 * and hence invalidate 'sp'. */
+	PUTBACK;
 	ffi_call (&cif, func_pointer, return_value_p, iinfo.args);
+	SPAGAIN;
 
 	/* free call-scoped data */
 	_invoke_free_after_call_handlers (&iinfo);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libglib-object-introspection-perl.git



More information about the Pkg-perl-cvs-commits mailing list