Re: [Ekiga-devel-list] Bug & design issue in the video options



Quoting Damien Sandras <dsandras seconix com>:

> Le vendredi 04 avril 2008 à 21:58 +0200, Julien Puydt a écrit :
> > Hi,
> >
> > I had a crash through the following code in opal-gmconf-bridge.cpp:
> >      GMManager::VideoOptions options;
> >      manager.get_video_options (options);
> >      options.maximum_received_bitrate = gm_conf_entry_get_int (entry);
> >      manager.set_video_options (options);
> >
> > The reason for the crash is that if you set the maximum_received_bitrate
> > to zero, it leads to "SIGFPE, Arithmetic exception.". And that is
> > exactly what this code does : it directly takes a gm_conf_get_int and
> > shoves where it hurts.
> >
> > If the key isn't set in gmconf, then gm_conf_get_int will spit a
> > warning... and return zero!
> >
> > So the obvious fix would be to check for zero before using this integer.
> >
> > But there is a better fix :
> > (1) either it shouldn't be possible to have direct write access to that
> > option.maximum_received_bitrate -- it should be private and only
> > accessible through a setter function, which would check what is given ;
> > (2) or the set_video_options should check option for sanity before
> > making them the used setting.
> >
>
> Matthias was taking care of this (iirc).

Hmm, I have taken care of this for SOME values that lead to a floating point
exception. I have "solved" the problem like this:
- In the specific gmconf-bridge I check if the value is in a valid range
- In case it is not, I do a gm_conf_set with a default value before reading it
again.

However I do not know if this is the correct place to do this. Perhaps there
should be a centralized place to check for value ranges and reset to defaults,
perhaps even using the schemas.in.in as input for the defaults in case a key
does not exist?

In case the gmconf-bridges are the right place, I could do a check for all
possible values there.

Matthias

[deleted]

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]