# New Ticket Created by  Felix Gallo 
# Please include the string:  [perl #31050]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=31050 >


Synopsis: in CVS as of Tue Aug 10 17:30:52 EDT 2004, the
examples/japh/japh[4,5,6,9].pasm examples all crash with
segmentation fault on my highly hacked up linux box.

They arguably should be working fine.  But that's neither
here nor there.  The problem this patch addresses is that
find_or_die attempts to get a class from a PMC which is
not necessarily an object, doesn't do error checking on 
that attempt, and then attempts to print the class's
object attributes.

The patch is attached.  

Tickling the bug (note that 10 and 13 are also broken):

$ for i in examples/japh/*.pasm  
> do
> echo $i
> ./parrot $i
> done
examples/japh/japh1.pasm
Just another Parrot Hacker
examples/japh/japh10.pasm
Js nte artHce
examples/japh/japh11.pasm
examples/japh/japh12.pasm
Just another Parrot Hacker
examples/japh/japh13.pasm
Js nte artHce
examples/japh/japh14.pasm
Just another Parrot Hacker
examples/japh/japh15.pasm
Just another Parrot Hacker
examples/japh/japh16.pasm
Just another Parrot Hacker
examples/japh/japh17.pasm
Just another Parrot Hacker
examples/japh/japh2.pasm
Just another Parrot Hacker
examples/japh/japh3.pasm
Just another Parrot Hacker
examples/japh/japh4.pasm
Segmentation fault
examples/japh/japh5.pasm
Segmentation fault
examples/japh/japh6.pasm
Segmentation fault
examples/japh/japh7.pasm
Just another Parrot Hacker
examples/japh/japh8.pasm
Just another Parrot Hacker
examples/japh/japh9.pasm
Segmentation fault
$

Felix
--- delegate.pmc        2004-08-10 23:29:33.000000000 +0200
+++ .#delegate.pmc.1.27 2004-08-10 22:59:34.000000000 +0200
@@ -85,14 +85,19 @@
         PMC *class = pmc;
         if (PObj_is_object_TEST(pmc)) {
             class = GET_CLASS((Buffer *)PMC_data(pmc), pmc);
-        }
-        internal_exception(METH_NOT_FOUND,
-                "Can't find method '%s' for object '%s'",
+            internal_exception(METH_NOT_FOUND,
+                "Can't find method '%s' for object '%s'\n",
                 string_to_cstring(interpreter, meth),
                 string_to_cstring(interpreter, PMC_str_val(
                         get_attrib_num((SLOTTYPE *)PMC_data(class),
                             PCD_CLASS_NAME)))
                 );
+        } else {
+            internal_exception(METH_NOT_FOUND,
+                "Can't find method '%s' - erroneous PMC\n",
+                string_to_cstring(interpreter, meth)
+                );
+       }
     }
     return returnPMC;
 }

Reply via email to