diff --git a/src/cpp/rtps/xmlparser/XMLDynamicParser.cpp b/src/cpp/rtps/xmlparser/XMLDynamicParser.cpp index 15a1488c065..f995fdbd9ce 100644 --- a/src/cpp/rtps/xmlparser/XMLDynamicParser.cpp +++ b/src/cpp/rtps/xmlparser/XMLDynamicParser.cpp @@ -606,6 +606,10 @@ XMLP_ret XMLParser::parseXMLBitmaskDynamicType( } const char* name = p_root->Attribute(NAME); + if (nullptr == name) + { + return XMLP_ret::XML_ERROR; + } p_dynamictypebuilder_t typeBuilder = types::DynamicTypeBuilderFactory::get_instance()->create_bitmask_builder(bit_bound); typeBuilder->set_name(name); diff --git a/test/unittest/xmlparser/XMLParserTests.cpp b/test/unittest/xmlparser/XMLParserTests.cpp index 804a3639876..2fa4e0650e5 100644 --- a/test/unittest/xmlparser/XMLParserTests.cpp +++ b/test/unittest/xmlparser/XMLParserTests.cpp @@ -50,6 +50,13 @@ using eprosima::fastrtps::xmlparser::XMLParser; using eprosima::fastdds::dds::Log; using eprosima::fastdds::dds::LogConsumer; +TEST_F(XMLParserTests, regressions) +{ + std::unique_ptr root; + + EXPECT_EQ(XMLP_ret::XML_ERROR, XMLParser::loadXML("regressions/12736.xml", root)); +} + TEST_F(XMLParserTests, NoFile) { std::unique_ptr root; diff --git a/test/unittest/xmlparser/regressions/12736.xml b/test/unittest/xmlparser/regressions/12736.xml new file mode 100644 index 00000000000..c0ced7bae81 Binary files /dev/null and b/test/unittest/xmlparser/regressions/12736.xml differ