Revision: 1319
Author: [email protected]
Date: Mon Jun 28 01:14:14 2010
Log: Pre-extend PL_endav to reduce risk of crashes in apps that don't handle PL_endav carefully, like mod_perl.

http://code.google.com/p/perl-devel-nytprof/source/detail?r=1319

Modified:
 /trunk/Changes
 /trunk/NYTProf.xs

=======================================
--- /trunk/Changes      Sat Jun 26 14:26:24 2010
+++ /trunk/Changes      Mon Jun 28 01:14:14 2010
@@ -15,6 +15,8 @@
 =head2 Changes in Devel::NYTProf 4.04

   Trace log messages are now flushed immediately.
+ Reduced risk of crashes in embedded applications that don't handle PL_endav
+    carefully, like mod_perl.

 =head2 Changes in Devel::NYTProf 4.03 (svn 1316) 19th June 2010

=======================================
--- /trunk/NYTProf.xs   Sat Jun 26 14:26:24 2010
+++ /trunk/NYTProf.xs   Mon Jun 28 01:14:14 2010
@@ -2955,6 +2955,12 @@
     if (!PL_checkav) PL_checkav = newAV();
     if (!PL_initav)  PL_initav  = newAV();
     if (!PL_endav)   PL_endav   = newAV();
+    /* pre-extend PL_endav to reduce the chance of DB::_END realloc'ing
+     * it while END blocks are executed (which could upset some embedded
+     * applications that don't handle PL_endav carefully, like mod_perl)
+     */
+    av_extend(PL_endav, av_len(PL_endav)+30);
+
     if (profile_start == NYTP_START_BEGIN) {
         enable_profile(aTHX_ NULL);
     } else {
@@ -4952,6 +4958,7 @@
         av_unshift(PL_endav, 1);  /* we want to be first */
         av_store(PL_endav, 0, SvREFCNT_inc(enable_profile_sv));
     }
+ av_extend(PL_endav, av_len(PL_endav)+20); /* see PL_endav in init_profiler() */
     if (trace_level >= 1)
         logwarn("~ INIT done\n");

--
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.

Group hosted at:  http://groups.google.com/group/develnytprof-dev
Project hosted at:  http://perl-devel-nytprof.googlecode.com
CPAN distribution:  http://search.cpan.org/dist/Devel-NYTProf

To post, email:  [email protected]
To unsubscribe, email:  [email protected]

Reply via email to