Sophie

Sophie

distrib > Mandriva > 2009.0 > i586 > by-pkgid > f194a318933ccb99e88f3b507d07bcaa > files > 4

rrdtool-1.3.3-1mdv2009.0.src.rpm

--- src/rrd_create.c	2008-06-10 19:12:55.000000000 -0400
+++ src/rrd_create.c.oden	2008-06-11 14:15:11.000000000 -0400
@@ -749,6 +749,15 @@ int rrd_create_fn(
         default:
             /* can not be zero because we don't know anything ... */
             rrd->cdp_prep->scratch[CDP_val].u_val = DNAN;
+               /* If the step is 0, we're going to have a BIG Floating Point Exception (i.e. SIGFPE). */
+               /* Example: (( 1202705167 - 67 ) % ( 300 * 0 )) / 300 */
+               if (rrd->rra_def[i].pdp_cnt == 0)
+               {
+                   rrd_set_error("Invalid step: must be greater than 0.");
+                   rrd_free(rrd);
+                   fclose(rrd_file);
+                   return(-1);
+               }
             /* startup missing pdp count */
             rrd->cdp_prep->scratch[CDP_unkn_pdp_cnt].u_cnt =
                 ((rrd->live_head->last_up -