Code

Merge branch 'upstream/1.3' into experimental
[pkg-rrdtool.git] / debian / patches / bts428778-floating-point-exception
1 Index: rrdtool/src/rrd_create.c
2 ===================================================================
3 --- rrdtool.orig/src/rrd_create.c       2008-02-24 16:12:49.000000000 +0100
4 +++ rrdtool/src/rrd_create.c    2008-02-24 16:13:34.000000000 +0100
5 @@ -619,6 +619,15 @@
6             default:
7                 /* can not be zero because we don't know anything ... */
8                 rrd->cdp_prep->scratch[CDP_val].u_val = DNAN;
9 +               /* If the step is 0, we're going to have a BIG Floating Point Exception (i.e. SIGFPE). */
10 +               /* Example: (( 1202705167 - 67 ) % ( 300 * 0 )) / 300 */
11 +               if (rrd->rra_def[i].pdp_cnt == 0)
12 +               {
13 +                   rrd_set_error("Invalid step: must be greater than 0.");
14 +                   rrd_free(rrd);
15 +                   fclose(rrd_file);
16 +                   return(-1);
17 +               }
18                 /* startup missing pdp count */
19                 rrd->cdp_prep->scratch[CDP_unkn_pdp_cnt].u_cnt = 
20                     ((rrd->live_head->last_up -