From: Salvador Ortiz Garcia Date: Fri, 28 May 2010 08:25:52 +0000 (+0200) Subject: Naif calls segfault T_PRTOBJ of the stock typemap X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dc1f0c2041dab5a98af69338d1fa501b5e90ac70;p=p5sagit%2Fp5-mst-13.2.git Naif calls segfault T_PRTOBJ of the stock typemap The T_PTROBJ INPUT in stock typemap only uses 'sv_derived_from' for input validation, that cause a segfault when the argument passed match the class name. --- diff --git a/lib/ExtUtils/typemap b/lib/ExtUtils/typemap index 2c35437..f888587 100644 --- a/lib/ExtUtils/typemap +++ b/lib/ExtUtils/typemap @@ -149,7 +149,7 @@ T_REF_IV_PTR ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, \"$var\", \"$ntype\") T_PTROBJ - if (sv_derived_from($arg, \"${ntype}\")) { + if (SvROK($arg) && sv_derived_from($arg, \"${ntype}\")) { IV tmp = SvIV((SV*)SvRV($arg)); $var = INT2PTR($type,tmp); }