[rrd-users] Re: PATCH: "rrdtool graph" and RRDs::graph coredumps

Thomas Parmelan tom at proxad.net
Wed Apr 5 20:06:28 MEST 2000

28 mars 2000, Tobias Oetiker <oetiker at ee.ethz.ch> :

> create a selfcontained script in the stile of what you find in the
> examples directory and send it over ...

Sorry for the delay. Creating a selfcontained script was not practical
for me so I gave a closer look to the problem in gdb with an unstripped
binary. The problem lies in rrd_graph.c function data_calc(), where
while growing the RPN stack you do this :

    stack = rrd_realloc(stack,dc_stacksize*sizeof(long));

but stack is not a *long, it's a *double !

Replacing sizeof(long) by sizeof(double) cured the problem for me. Here
is the fix in patch format (lines number will however differ from your
version) :

--- rrdtool-1.0.14.dist/src/rrd_graph.c	Sun Apr  2 17:54:00 2000
+++ rrdtool-1.0.14-t/src/rrd_graph.c	Wed Apr  5 19:44:55 2000
@@ -948,7 +948,7 @@
 	    for (rpi=0;im->gdes[gdi].rpnp[rpi].op != OP_END;rpi++){
 		if (stptr +5 > dc_stacksize){
 		    dc_stacksize += dc_stackblock;		
-		    stack = rrd_realloc(stack,dc_stacksize*sizeof(long));
+		    stack = rrd_realloc(stack,dc_stacksize*sizeof(double));
 		    if (stack==NULL){
 			rrd_set_error("RPN stack overflow");
 			return -1;

tom at proxad.net  --  Linux : the Penguin is FREE !  --  tom at ankh.fr.EU.org
Usenet Canal Historique               Le SPAM, il ne passera pas par moi!

Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users

More information about the rrd-users mailing list