Code

Refreshing patches, dropping bts625631-gcc4.5.
[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 @@ -771,6 +771,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_free2(rrd);
14 +                rrd_close(rrd_file_dn);
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 -