PR gprof/13325
authorNick Clifton <nickc@redhat.com>
Tue, 25 Oct 2011 08:38:49 +0000 (08:38 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 25 Oct 2011 08:38:49 +0000 (08:38 +0000)
* hist.c (hist_assign_samples_1): Make sure that inner loop
iterator remains valid.

gprof/ChangeLog
gprof/hist.c

index fd989950aa9e229115bcccdcaa7be88a4bb488c0..20464e8da1f8b2af303e21e72a7a9f96549578a3 100644 (file)
@@ -1,3 +1,9 @@
+2011-10-25   Wei Guozhi  <carrot@google.com>
+
+       PR gprof/13325
+       * hist.c (hist_assign_samples_1): Make sure that inner loop
+       iterator remains valid.
+
 2011-10-24  Nick Clifton  <nickc@redhat.com>
 
        * po/ja.po: New Japanese translation.
index 25364b215e823fe633a7823f0d7a895db547a3ee..572bacfb22a11b5095179526b57876aa27d089a7 100644 (file)
@@ -398,7 +398,12 @@ hist_assign_samples_1 (histogram *r)
          /* If high end of bin is below entry address,
             go for next bin.  */
          if (bin_high_pc < sym_low_pc)
-           break;
+           {
+             /* PR gprof/13325: Make sure that j does not go below 1.  */
+             if (j < 1)
+               j = 1;
+             break;
+           }
 
          /* If low end of bin is above high end of symbol,
             go for next symbol.  */