Code

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