[rrd-users] rrd_diff - Core Dump / Seg Fault (+patch)

Carlos Vicente cvicente at network-services.uoregon.edu
Thu Mar 28 19:32:58 MET 2002


I was getting the same kind of seg fault in Linux.  Your patch seemed to
solve the problem.
Thanks.

I wonder why it hasn't been fixed yet in the latest version (1.0.35).


-- 
Carlos Vicente              
Network Engineer            
Computing Center	    
University of Oregon        


      To: rrd-users at list.ee.ethz.ch 
      Subject: Core Dump / Seg Fault (+patch) 
      From: Oliver Cook <ollie at uk.clara.net> 
      Date: Fri, 6 Apr 2001 18:08:55 +0100 
      Delivered-To: slist at ee.ethz.ch 
      Sender: Oliver Cook <ollie at mutare.noc.clara.net> 
      User-Agent: Mutt/1.2.5i 

  rrdtool 1.0.33 can be made to seg fault in the
  following way:

  mutare# gdb rrdtool
  GNU gdb 4.18
  Copyright 1998 Free Software Foundation, Inc.
  GDB is free software, covered by the GNU General Public License, and
you are
  welcome to change it and/or distribute copies of it under certain
conditions.
  Type "show copying" to see the conditions.
  There is absolutely no warranty for GDB.  Type "show warranty" for
details.
  This GDB was configured as "i386-unknown-freebsd"...
  (gdb) r update poseidon-traffic-1.rrd N::
  Starting program: /usr/home/ollie/rrdtest/rrdtool update
poseidon-traffic-1.rrd N::

  Program received signal SIGSEGV, Segmentation fault.
  0x805d8a6 in rrd_diff (a=0x8097000 <Error reading address 0x8097000:
Bad address>, b=0x8093100 "") at rrd_diff.c:33
  33              a++;
  (gdb)

  This is due to a bug in rrd_diff, which the following
  patch fixes. The bug is that "!" takes a higher preference
  than "||".

  --- rrd_diff.c.orig     Fri Apr  6 17:57:53 2001
  +++ rrd_diff.c  Fri Apr  6 18:05:29 2001
  @@ -29,13 +29,13 @@
       char res[LAST_DS_LEN+1], *a1, *b1, *r1, *fix;
       int c,x,m;

  -    while (!isdigit((int)*a) || *a==0)
  +    while (!(isdigit((int)*a) || *a==0))
           a++;
       fix=a;
       while (isdigit((int)*fix))
          fix++;
       *fix = 0; /* maybe there is some non digit data in the string */
  -    while (!isdigit((int)*b) || *b==0)
  +    while (!(isdigit((int)*b) || *b==0))
           b++;
       fix=b;
       while (isdigit((int)*fix))

  Yours,

  Ollie

  -- 
  Oliver Cook    Systems Administrator, ClaraNET
  ollie at uk.clara.net      020 7903 3000 ext. 291

--
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
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list