bugBattle for Wesnoth - Bugs: bug #20360, Wesnoth 1.11.1 crashes on startup

 
 
Show feedback again

bug #20360: Wesnoth 1.11.1 crashes on startup

Submitted by:  None
Submitted on:  Sun 09 Dec 2012 09:31:55 PM UTC  
 
Category: BugSeverity: 4 - Important
Priority: 5 - NormalItem Group:  None of the others
Status: FixedPrivacy: Public
Assigned to: J Tyne <jamit>Originator Email: -unavailable-
Open/Closed: ClosedRelease: 1.11.1
Operating System: Linux Ubuntu

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 13 Dec 2012 02:23:09 PM UTC, comment #5:

For future reference, here is what seems to be happening. The crash occurs in escaped_string() when it is called from write_key_val_visitor::operator()(t_string const&). That calling function consists of a loop whose loop control variable is a t_string::walker, and that walker is constructed from a t_string. All looks fine so far.

The first wrinkle is that a walker does not have a constructor from a t_string. The code compiles though, since it does have a constructor from a t_string_base, and t_string is implicitly convertible to t_string_base. The root of the problem is here: t_string is implicitly convertible to a t_string_base object, not to a const reference to a t_string_base. That means that the constructor is actually called with a temporary t_string_base object (which is not guaranteed to exist after the construction is complete).

Things can blow up later because a walker retains a reference to one of the data fields in the object it is initialized from (and that object might no longer exist when the reference is used).

J Tyne <jamit>
Project MemberIn charge of this item.
Thu 13 Dec 2012 02:22:35 PM UTC, SVN revision 55857:

Change some implicit conversions to return const references to objects instead of temporary objects.

Fixes bug #20360.

(Browse SVN revision 55857)

J Tyne <jamit>
Project MemberIn charge of this item.
Tue 11 Dec 2012 09:34:37 PM UTC, comment #3:

forum thread: http://forums.wesnoth.org/viewtopic.php?f=4&t=38017&p=544253#p544253

(thought the link is already here sorry)

Anonymissimus <anonymissimus>
Project Member
Tue 11 Dec 2012 09:33:35 PM UTC, comment #2:

(more info in the forum thread)

jamit: Assigning this to you, since it looks as if your changes to parser.cpp, which also happened in the time range in question, are triggering or causing this. (r55684 ?)

Anonymissimus <anonymissimus>
Project Member
Mon 10 Dec 2012 05:20:47 AM UTC, comment #1:

Using bt in gdb showed this result:
#0 0x092a5be4 in (anonymous namespace)::escaped_string(__gnu_cxx::__normal_iterator<char const*, std::string> const&, __gnu_cxx::__normal_iterator<char const*, std::string> const&) ()
#1 0x092a5ff9 in (anonymous namespace)::write_key_val_visitor::operator()(t_string const&) const ()
#2 0x092a8700 in void boost::detail::variant::invoke_visitor<(anonymous namespace)::write_key_val_visitor const>::internal_visit<t_string const>(t_string const&, int) ()
#3 0x092a85d5 in boost::detail::variant::invoke_visitor<(anonymous namespace)::write_key_val_visitor const>::result_type boost::detail::variant::visitation_impl_invoke_impl<boost::detail::variant::invoke_visitor<(anonymous namespace)::write_key_val_visitor const>, void const*, t_string>(int, boost::detail::variant::invoke_visitor<(anonymous namespace)::write_key_val_visitor const>&, void const*, t_string*, mpl_::bool_<true>) ()
#4 0x092a8364 in boost::detail::variant::invoke_visitor<(anonymous namespace)::write_key_val_visitor const>::result_type boost::detail::variant::visitation_impl_invoke<boost::detail::variant::invoke_visitor<(anonymous namespace)::write_key_val_visitor const>, void const*, t_string, boost::variant<boost::blank, bool, double, std::string, t_string, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_

Anonymous
Sun 09 Dec 2012 09:31:55 PM UTC, original submission:

When I freshly compiled wesnoth 1.11.1 from source using make on Linux Ubuntu 12.10, it crashed on startup. I deleted all files, compiled and installed it again, and it crashed again. 1.11.0 worked well when I compiled and installed it in the same way.

The error was a segmentation fault, with gdb, I came to this error log:

Program received signal SIGSEGV, Segmentation fault.
0x092a5be4 in (anonymous namespace)::escaped_string(__gnu_cxx::__normal_iterator<char const*, std::string> const&, __gnu_cxx::__normal_iterator<char const*, std::string> const&) ()

Anonymous

 

(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by shadowmaster (Updated the item)
  • -unavailable- added by jamit (Posted a comment)
  • -unavailable- added by anonymissimus (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 26 Mar 2013 12:35:53 PM UTCshadowmasterOpen/ClosedOpen=>Closed
    Thu 13 Dec 2012 02:23:09 PM UTCjamitStatusNone=>Fixed
    Tue 11 Dec 2012 09:33:35 PM UTCanonymissimusAssigned toNone=>jamit
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup