develooper Front page | perl.perl5.porters | Postings from May 2010

[PATCH] Naif calls segfault T_PRTOBJ of the stock typemap

Thread Next
Salvador Ortiz Garcia
May 27, 2010 09:23
[PATCH] Naif calls segfault T_PRTOBJ of the stock typemap
Message ID:

$ perl -MPOSIX -e 'POSIX::Termios->getattr()'
Segmentation fault (core dumped)

$ perl -MGDBM_File -e 'GDBM_File->FETCH(1)'
Segmentation fault (core dumped)

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.

That typemap is used a little in core but in tons  in CPAN.

The following fixes it:

--- ExtUtils/typemap    2010-01-18 12:43:46.000000000 -0600
+++ ExtUtils/    2010-05-27 11:03:18.138328347 -0500
@@ -149,7 +149,7 @@
              \"$var\", \"$ntype\")
-    if (sv_derived_from($arg, \"${ntype}\")) {
+    if (SvROK($arg) && sv_derived_from($arg, \"${ntype}\")) {
          IV tmp = SvIV((SV*)SvRV($arg));
          $var = INT2PTR($type,tmp);


Salvador Ortiz.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About