[svn:parrot] r37980 - trunk/src/pmc

jonathan at svn.parrot.org jonathan at svn.parrot.org
Wed Apr 8 17:16:34 UTC 2009


Author: jonathan
Date: Wed Apr  8 17:16:33 2009
New Revision: 37980
URL: https://trac.parrot.org/parrot/changeset/37980

Log:
[core] Parrot Subs that get their arity inspected cache the information. However, when we cloned, we ended up with two subs sharing that cache. This could lead to double frees, or (in the case that led to me discovering this bug) a sub reporting an arity of over sixty thousand.

Modified:
   trunk/src/pmc/sub.pmc

Modified: trunk/src/pmc/sub.pmc
==============================================================================
--- trunk/src/pmc/sub.pmc	Wed Apr  8 12:25:10 2009	(r37979)
+++ trunk/src/pmc/sub.pmc	Wed Apr  8 17:16:33 2009	(r37980)
@@ -406,6 +406,10 @@
         if (sub->name != NULL)
             sub->name = Parrot_str_copy(INTERP, sub->name);
 
+        /* Be sure not to share arg_info. */
+        if (dest_sub->arg_info)
+            dest_sub->arg_info = NULL;
+
         if (sub->ctx)
             Parrot_context_ref(INTERP, sub->ctx);
         if (sub->outer_ctx)


More information about the parrot-commits mailing list