[rrd-developers] [PATCH]crash with rrd_fetch
trueweck at 163.com
Tue Nov 25 10:07:34 CET 2008
create a rrd database with the following statement:
start=`date +'00:00 %m/%e/%Y'`
/usr/bin/rrdtool create $1.rrd \
--start "$start" \
--step 300 \
when fetch data between several days with rrd_fetch, rrd_fecth will crash.
gdb the core file, finally I found that there is a overflow in rrd_fetch.c.
here is the patch
diff -Nur rrdtool-1.3.4/rrdtool-1.3.4/src/rrd_fetch.c
--- rrdtool-1.3.4/rrdtool-1.3.4/src/rrd_fetch.c Sun Oct 5 00:04:04
+++ rrdtool-1.3.4_/rrdtool-1.3.4/src/rrd_fetch.c Tue Nov 25 16:55:04 2008
@@ -345,7 +345,7 @@
rra_start_time = (rra_end_time
- (*step * (rrd.rra_def[chosen_rra].row_cnt - 1)));
/* here's an error by one if we don't be careful */
- start_offset = (long) (*start + *step - rra_start_time) / (long) *step;
+ start_offset = (long)(((double)(*start)/(long)*step) + 1 -
end_offset = (long) (rra_end_time - *end) / (long) *step;
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rrd-developers