You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by do...@apache.org on 2002/04/09 22:19:25 UTC

cvs commit: modperl-2.0/xs typemap

dougm       02/04/09 13:19:25

  Modified:    xs       typemap
  Log:
  override T_PTROBJ INPUT typemap to croak if object is not a blessed
  reference, to prevent possible segv from e.g. Apache::Server->process
  
  Revision  Changes    Path
  1.6       +11 -0     modperl-2.0/xs/typemap
  
  Index: typemap
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/typemap,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- typemap	25 Sep 2001 19:44:03 -0000	1.5
  +++ typemap	9 Apr 2002 20:19:25 -0000	1.6
  @@ -19,6 +19,17 @@
   
   ######################################################################
   INPUT
  +T_PTROBJ
  +	if (SvROK($arg) && sv_derived_from($arg, \"${ntype}\")) {
  +	    IV tmp = SvIV((SV*)SvRV($arg));
  +	    $var = INT2PTR($type,tmp);
  +	}
  +	else {
  +	    Perl_croak(aTHX_ SvROK($arg) ?
  +                       \"$var is not of type ${ntype}\" :
  +                       \"$var is not a blessed reference\");
  +        }
  +
   T_APACHEOBJ
   	$var = modperl_xs_sv2request_rec(aTHX_ $arg, \"$ntype\", cv)