So, I'm parsing this xml:
<layout>
<elements>
<first>
<x>centered</x>
<y>300</y>
<text>Button</text>
<function>toggleOption</function>
</first>
<second>no</second>
</elements>
</layout>
It's being parsed by the rapidxml library. Here are the relevant lines of code:
rapidxml::xml_document<> doc;
doc.parse<0>(big_buffer);
rapidxml::xml_node<>* element_ptr = doc.first_node("layout")->first_node("elements")->first_node();
while(element_ptr){
printf("FOUND: '%s'\n", element_ptr->name());
element_ptr = element_ptr->next_sibling();
}
Running this causes:
FOUND: 'first'
FOUND: 'second'
*** stack smashing detected ***: ./program terminated
Aborted (core dumped)
I followed the pattern here, but the problem is element_ptr
doesn't have a next_sibling()
. No biggy, but the fact the element_ptr->next_sibling()
causes a crash is no fun.