Re: [Flightgear-devel] [PATCH] Fix fgviewer segfault
Jeff Taylor wrote: Is Terragear still being maintained? The current version doesn't even compile without errors. I have a couple of fixes there. I'll just attach them to this message for now. In the future, should I make separate e-mails for each? I will likely keep posting patches as I hit roadblocks in my own coding [...] Yes, please :-) The most recent TerraGear code is maintained here: http://mapserver.flightgear.org/git/gitweb.pl?p=terragear-cs At a first glance it looks like your patches are supposed to be applied to exactly this tree - I'll forward the patches to the maintainer. Thanks, Martin. -- Unix _IS_ user friendly - it's just selective about who its friends are ! -- -- ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] [PATCH] Fix fgviewer segfault
On Sat, May 22, 2010 at 10:30 PM, Jeff Taylor jefftaylo...@gmail.comwrote: Hello, fgviewer crashes when reading channel options (which it doesn't use). Here is a patch which fixes this by adding a pointer check. This is my first ever patch to any open source project, so feedback would be appreciated. :) I've committed this; thanks for the patch. There's not much to say about the code in the patch, but I do have some advice about the comments. It's almost never necessary to justify a null pointer check, so the comment there is redundant. The comment is actually a justification for why we should accept the patch; as such, it belongs in the commit message i.e., the body of your email. The second comment about the return value not being checked is not relevant at all in this function and is quite likely to be made obsolete. I replaced it with an XXX style comment in the caller of add_channel as a reminder to look into this. Tim Jeff Taylor --- src/Main/options.cxx |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/Main/options.cxx b/src/Main/options.cxx index bededfb..0132c02 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -530,6 +530,14 @@ parse_fov( const string arg ) { static bool add_channel( const string type, const string channel_str ) { +// This check is neccessary to prevent fgviewer from segfaulting when given +// weird options. (It doesn't run the full initailization) +if(globals-get_channel_options_list() == NULL) +{ +SG_LOG(SG_GENERAL, SG_ALERT, Option type = channel_str + ignored.); +return false; // This isn't checked for, but it shouldn't matter +} SG_LOG(SG_GENERAL, SG_INFO, Channel string = channel_str ); globals-get_channel_options_list()-push_back( type + , + channel_str ); return true; -- 1.7.0.1 -- ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel -- ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] [PATCH] Fix fgviewer segfault
Jeff wrote: fgviewer crashes when reading channel options (which it doesn't use). Here is a patch which fixes this by adding a pointer check. If you feel happy creating patches for fgviewer, here's another issue that really should be looked at IMO... http://code.google.com/p/flightgear-bugs/issues/detail?id=117 Thanks! Gijs _ Download nu eenvoudig leuke Emoticons voor je Messenger GRATIS http://www.rulive.nl/aspx/emoticons.aspx-- ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
[Flightgear-devel] [PATCH] Fix fgviewer segfault
Hello, fgviewer crashes when reading channel options (which it doesn't use). Here is a patch which fixes this by adding a pointer check. This is my first ever patch to any open source project, so feedback would be appreciated. :) Jeff Taylor --- src/Main/options.cxx |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/Main/options.cxx b/src/Main/options.cxx index bededfb..0132c02 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -530,6 +530,14 @@ parse_fov( const string arg ) { static bool add_channel( const string type, const string channel_str ) { +// This check is neccessary to prevent fgviewer from segfaulting when given +// weird options. (It doesn't run the full initailization) +if(globals-get_channel_options_list() == NULL) +{ +SG_LOG(SG_GENERAL, SG_ALERT, Option type = channel_str + ignored.); +return false; // This isn't checked for, but it shouldn't matter +} SG_LOG(SG_GENERAL, SG_INFO, Channel string = channel_str ); globals-get_channel_options_list()-push_back( type + , + channel_str ); return true; -- 1.7.0.1 -- ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel