[rrd-developers] [rrd] Re: "rrdtool restore" error handling and implementation

Tobias Oetiker tobi at oetiker.ch
Sun Feb 24 15:30:11 CET 2008


Hi Terje,

the rrd_restore command does not realy try to make sure you feed it
valid data, but as I said it should not segfault ... here is the
patch for this

--- rrd_restore.c       (revision 1290)
+++ rrd_restore.c       (working copy)
@@ -314,7 +314,10 @@
       eat_tag(&ptr2,"cdp_prep");
       for(i=0;i< (int)rrd->stat_head->ds_cnt;i++)
       {
-      eat_tag(&ptr2,"ds");
+         if (eat_tag(&ptr2, "ds") != 1){
+            rrd_set_error("expected to find %lu <ds> entries in <cdp_prep>",rrd->stat_head->ds_cnt);
+            return -1;
+         }
       /* support to read CDP parameters */
       rra_index = rrd->stat_head->rra_cnt-1;
       skip(&ptr2);



cheers
tobi


Friday Terje Bless wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> tobi at oetiker.ch (Tobias Oetiker) wrote:
>
> >rrdtool restore should not crash ... it should complain ... could you
> >please send me that crasher example ? The shorter the better!
>
> Attached (as minimal as I can make it). CC'ed in case the list
> eats attachments.
>
>
> The pattern is an RRD with two RRAs, each with one DS. When I
> add a DS to the first RRA, but not to the second, rrdtool
> restore segfaults. I think I've eliminated other editing errors
> (values, cdef, etc.), but I'm not that well versed in rrdtool so
> it's not unreasonable to assume I've made other booboos in there.
>
> This is with rrdtool 1.2.23 on RHEL5 x86. I can't easily build
> SVN trunk on that box (among other things it's behind paranoid
> firewalls etc.), so I haven't tested if this problem still
> exists there. If necessary I can try and get set up for testing
> this on a Fedora box.
>
>
> HTH, -link
>
>
> - --
>    ?Fly it until the last piece stops moving??
>
> -----BEGIN PGP SIGNATURE-----
> Version: PGP SDK 3.10
>
> wj8DBQFHvoHGo/I+siR19ewRAldEAKDy0H40pclVUtl8fv9U1RAL6FPe5gCfU4OL
> 3k8T9O085o1ZIklTfeXVNfg=s4Z7
> -----END PGP SIGNATURE-----

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten
http://it.oetiker.ch tobi at oetiker.ch ++41 62 213 9902



More information about the rrd-developers mailing list