Revision: 1342
Author: [email protected]
Date: Sun Sep 12 04:12:04 2010
Log: Detect bad line numbers (-1 stored as unsigned) in sub caller data.

Now generates warnings like this:
MooseX::Method::Signatures::inject_scope called by String::Bag::Solver::be...@0 at fid 24 line 4294967295 - crazy line number changed to 0 Devel::Declare::done_declare called by main::be...@12 at fid 24 line 4294967295 - crazy line number changed to 0 String::Bag::Solver::be...@0 called by main::be...@12 at fid 24 line 4294967295 - crazy line number changed to 0


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

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

=======================================
--- /trunk/Changes      Fri Jul  9 06:06:43 2010
+++ /trunk/Changes      Sun Sep 12 04:12:04 2010
@@ -6,6 +6,12 @@

 =cut

+=head2 Changes in Devel::NYTProf 4.05 (svn 1340) 12th Sept 2010
+
+  Fixed handling of negative values for subroutine line ranges
+    (that may be added to %DB::sub by buggy software).
+  Protect against bad line numbers hanging report generation.
+
 =head2 Changes in Devel::NYTProf 4.04 (svn 1332) 9th July 2010

   Profile now reports presence of the slow regex match vars ($& $' $`).
=======================================
--- /trunk/NYTProf.xs   Sun Sep 12 02:52:25 2010
+++ /trunk/NYTProf.xs   Sun Sep 12 04:12:04 2010
@@ -3348,6 +3348,13 @@
             }
             /* trim length to effectively hide the [fid:line] suffix */
             caller_subname_len = (I32)(fid_line_start-caller_subname);
+
+ /* catch negative line numbers that have been stored unsigned */
+            if (line > 2147483648) { /* 2**31 */
+ logwarn("%s called by %.*s at fid %u line %u - crazy line number changed to 0\n", + called_subname, (int)caller_subname_len, caller_subname, fid, line);
+                line = 0;
+            }

             count = uv_from_av(aTHX_ av, NYTP_SCi_CALL_COUNT, 0);
             sc[NYTP_SCi_CALL_COUNT] = count * 1.0;

--
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