segmentation fault in CEGUI Base with malformed falagard xml

Create issue
Issue #1089 resolved
Christopher Beck created an issue

Operating System Linux Mint 17 (64-bit)

Reproducibility: always

Reproduction steps:

  1. Download the following small test case "segfault project".
  2. Open the project in CEED (should work normally)
  3. Now go to looknfeel/segfault.looknfeel, to line 167, and remove the comment inserting an innocent looking <VertAlignment ... /> tag.
  4. CEED should segfault immediately on loading the project now.

I reproduce this crash also in my C++ application, it is a crash in the XML parser in cegui base. Here is the backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff77f31a0 in CEGUI::WidgetComponent::setVerticalWidgetAlignment(CEGUI::VerticalAlignment) ()
   from /home/chris/cegui-src/cegui-master//build/lib/
(gdb) bt
#0  0x00007ffff77f31a0 in CEGUI::WidgetComponent::setVerticalWidgetAlignment(CEGUI::VerticalAlignment) ()
   from /home/chris/cegui-src/cegui-master//build/lib/
#1  0x00007ffff7827f2d in CEGUI::Falagard_xmlHandler::elementVertAlignmentStart(CEGUI::XMLAttributes const&) ()
   from /home/chris/cegui-src/cegui-master//build/lib/
#2  0x00007ffff78277c2 in CEGUI::Falagard_xmlHandler::elementStartLocal(CEGUI::String const&, CEGUI::XMLAttributes const&) ()
   from /home/chris/cegui-src/cegui-master//build/lib/
#3  0x00007fffed291bac in CEGUI::ExpatParser::startElement(void*, char const*, char const**) ()
   from /home/chris/cegui-src/cegui-master//build/lib/
#4  0x00007fffed8e066a in ?? () from /lib/x86_64-linux-gnu/
#5  0x00007fffed8e164e in ?? () from /lib/x86_64-linux-gnu/
#6  0x00007fffed8df9e1 in ?? () from /lib/x86_64-linux-gnu/
#7  0x00007fffed8e016d in ?? () from /lib/x86_64-linux-gnu/
#8  0x00007fffed8e35df in XML_ParseBuffer () from /lib/x86_64-linux-gnu/
#9  0x00007fffed29074d in CEGUI::ExpatParser::parseXML(CEGUI::XMLHandler&, CEGUI::RawDataContainer const&, CEGUI::String const&) ()
   from /home/chris/cegui-src/cegui-master//build/lib/
#10 0x00007ffff7668ff4 in CEGUI::XMLParser::parseXMLFile(CEGUI::XMLHandler&, CEGUI::String const&, CEGUI::String const&, CEGUI::String const&) ()
   from /home/chris/cegui-src/cegui-master//build/lib/
#11 0x00007ffff781582b in CEGUI::WidgetLookManager::parseLookNFeelSpecificationFromFile(CEGUI::String const&, CEGUI::String const&) ()
   from /home/chris/cegui-src/cegui-master//build/lib/
#12 0x00007ffff76ad256 in CEGUI::Scheme::loadLookNFeels() () from /home/chris/cegui-src/cegui-master//build/lib/
#13 0x00007ffff76b3fa3 in CEGUI::Scheme::loadResources() () from /home/chris/cegui-src/cegui-master//build/lib/
#14 0x00000000004094b3 in CEGUI::NamedXMLResourceManager<CEGUI::Scheme, CEGUI::Scheme_xmlHandler>::doExistingObjectAction(CEGUI::String, CEGUI::Scheme*, CEGUI::XMLResourceExistsAction) ()
#15 0x00000000004089a9 in CEGUI::NamedXMLResourceManager<CEGUI::Scheme, CEGUI::Scheme_xmlHandler>::createFromFile(CEGUI::String const&, CEGUI::String const&, CEGUI::XMLResourceExistsAction) ()
#16 0x0000000000407077 in init_CEGUI(int, int) ()
#17 0x000000000040786f in cegui_opengl_application::cegui_opengl_application(std::string, int, int) ()
#18 0x000000000040456c in main ()

Comments (6)

  1. Lukas Meindl

    VertAlignment and HorzAlignment are for Child windows. You specify an Area for a TextComponent. They cannot have Alignments. They can have vertical and horizontal Formattings though.

    Please explain what you are trying to accomplish exactly by setting HorzAlignment. Maybe we can figure out if this is a missing feature or not.

  2. Lukas Meindl

    This was not really a bug, but rather a user mistake. I added exceptions to give better info and throw exceptions on this in the future, see this commit in v0-8 : a79771e

  3. Log in to comment