diff --git a/src/cpp/xmlparser/XMLDynamicParser.cpp b/src/cpp/xmlparser/XMLDynamicParser.cpp index 00860220743..8f4549131ef 100644 --- a/src/cpp/xmlparser/XMLDynamicParser.cpp +++ b/src/cpp/xmlparser/XMLDynamicParser.cpp @@ -982,9 +982,16 @@ XMLP_ret XMLParser::parseXMLStructDynamicType( const char* baseType = p_root->Attribute(BASE_TYPE); if (baseType != nullptr) { - DynamicTypeBuilder::_ref_type parent_type_builder; + DynamicTypeBuilder::_ref_type parent_type_builder = nullptr; XMLProfileManager::getDynamicTypeBuilderByName(parent_type_builder, baseType); - DynamicType::_ref_type parent_type = parent_type_builder->build(); + + DynamicType::_ref_type parent_type = nullptr; + + if (nullptr != parent_type_builder) + { + parent_type = parent_type_builder->build(); + } + if (parent_type && (TK_STRUCTURE == parent_type->get_kind() || TK_STRUCTURE == traits::narrow(parent_type)->resolve_alias_enclosed_type()->get_kind())) diff --git a/test/unittest/xmlparser/XMLParserTests.cpp b/test/unittest/xmlparser/XMLParserTests.cpp index bfb5657f736..fc6765485d0 100644 --- a/test/unittest/xmlparser/XMLParserTests.cpp +++ b/test/unittest/xmlparser/XMLParserTests.cpp @@ -82,6 +82,7 @@ TEST_F(XMLParserTests, regressions) EXPECT_EQ(XMLP_ret::XML_ERROR, XMLParser::loadXML("regressions/21154_profile_bin.xml", root)); EXPECT_EQ(XMLP_ret::XML_ERROR, XMLParser::loadXML("regressions/21181_profile_bin.xml", root)); EXPECT_EQ(XMLP_ret::XML_ERROR, XMLParser::loadXML("regressions/21223_profile_bin.xml", root)); + EXPECT_EQ(XMLP_ret::XML_ERROR, XMLParser::loadXML("regressions/21334_profile_bin.xml", root)); Log::Flush(); } diff --git a/test/unittest/xmlparser/regressions/21334_profile_bin.xml b/test/unittest/xmlparser/regressions/21334_profile_bin.xml new file mode 100644 index 00000000000..981f4b7db30 --- /dev/null +++ b/test/unittest/xmlparser/regressions/21334_profile_bin.xml @@ -0,0 +1 @@ +amp=! >�lt_pro]fil"��=""�=" "����=""�dev/Abi�ui" ="013921003y_type="int64" mapMaxL}ngpe="ohtet" �!������������W��A�����������devhKlmT71��" /> f����"/>>�mt_pro]fil"��=""�=" "mapMaxLengpe="octet" mapMaxLength="-0����������ev/Abi�ureplier777777762���77762����888888��9[" />/ \ No newline at end of file