diff --git a/src/cpp/xmlparser/XMLDynamicParser.cpp b/src/cpp/xmlparser/XMLDynamicParser.cpp index 21572dcef60..abfb976af00 100644 --- a/src/cpp/xmlparser/XMLDynamicParser.cpp +++ b/src/cpp/xmlparser/XMLDynamicParser.cpp @@ -1309,14 +1309,46 @@ DynamicType::_ref_type XMLParser:: parseXMLMemberDynamicType( if (!isArray) { - member = factory->create_sequence_type(content_type, length)->build(); + DynamicTypeBuilder::_ref_type inner_builder{factory->create_sequence_type(content_type, length)}; + if (nullptr != inner_builder) + { + member = inner_builder->build(); + } + else + { + EPROSIMA_LOG_ERROR(XMLPARSER, + "Error parsing sequence element type: Cannot recognize inner content of member: " << + memberType); + return {}; + } } else { - DynamicTypeBuilder::_ref_type inner_builder {factory->create_sequence_type(content_type, length)}; - std::vector bounds; - dimensionsToArrayBounds(memberArray, bounds); - member = factory->create_array_type(inner_builder->build(), bounds)->build(); + DynamicTypeBuilder::_ref_type inner_builder{factory->create_sequence_type(content_type, length)}; + if (nullptr != inner_builder) + { + std::vector bounds; + dimensionsToArrayBounds(memberArray, bounds); + DynamicTypeBuilder::_ref_type sub_builder{factory->create_array_type(inner_builder->build(), bounds)}; + if (nullptr != sub_builder) + { + member = sub_builder->build(); + } + else + { + EPROSIMA_LOG_ERROR(XMLPARSER, + "Error parsing sequence element type: Cannot recognize inner content of member: " << + memberType); + return {}; + } + } + else + { + EPROSIMA_LOG_ERROR(XMLPARSER, + "Error parsing sequence element type: Cannot recognize inner content of member: " << + memberType); + return {}; + } } } else if (p_root->Attribute(MAP_MAXLENGTH) != nullptr) diff --git a/test/unittest/xmlparser/XMLParserTests.cpp b/test/unittest/xmlparser/XMLParserTests.cpp index 8675542db1a..eb5f56f534f 100644 --- a/test/unittest/xmlparser/XMLParserTests.cpp +++ b/test/unittest/xmlparser/XMLParserTests.cpp @@ -85,6 +85,7 @@ TEST_F(XMLParserTests, regressions) EXPECT_EQ(XMLP_ret::XML_ERROR, XMLParser::loadXML("regressions/21334_profile_bin.xml", root)); EXPECT_EQ(XMLP_ret::XML_ERROR, XMLParser::loadXML("regressions/21856_profile_bin.xml", root)); EXPECT_EQ(XMLP_ret::XML_ERROR, XMLParser::loadXML("regressions/22054_profile_bin.xml", root)); + EXPECT_EQ(XMLP_ret::XML_ERROR, XMLParser::loadXML("regressions/22101_profile_bin.xml", root)); Log::Flush(); } diff --git a/test/unittest/xmlparser/regressions/22101_profile_bin.xml b/test/unittest/xmlparser/regressions/22101_profile_bin.xml new file mode 100644 index 00000000000..563e25810f4 --- /dev/null +++ b/test/unittest/xmlparser/regressions/22101_profile_bin.xml @@ -0,0 +1,2 @@ +>>’:’’ nAAĮA’ sionsion/>nA¢¢¢AAA3Dy)edef type=""sequenceMaxLength="-255§§§§§Multua" name="" arrayDimensnons="" />sions]on/>nA¢¢¢AAA1Dy)y’p’’’’’’’’def type=""sequenceMaxLength="(255§§§§§Multica" name="" arrayDimensions="" />sin/>§§§§§Mua" n/>nA¢¢¢AAA3Dy)y’pe> sionsion/>nA¢¢¢AAA77407812Dy)y’pe> sin/>nAAĮAAAAAA430097419635D2/shm +’d-sC$@Cdtypee="string"sequenceMaxLength="-4295000065§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>nA¢¢¢AAA1Dy)y’p’’’’’’’’def type=""sequenceMaxmension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>ny)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>nAAĮAAAAAA860194839271Dy)ype> sin/>§§§§§Mua" nltica" name="" arra arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>nAAĮAAAAAA430097419635Dy)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>nAAĮAAAAAA860194839271Dy)ype> sin/>§§§§§Mua" naxLengt:="-0a" name="" aņrayDimensions="" />nAAĮA’ sionsion/>nA¢¢¢AAA3Dy)edef type=""sequenceMaxLength="-255§§§§§Multua" name="" arrayDimensnons="" />sions]on/>nA¢¢¢AAA1Dy)y’p’’’’’’’’def type=""sequenceMaxLength="(255§§§§§Multica" name="" arrayDimensions="" />sin/>§§§§§Muname="" arrayDimension="" />sin/>§§§§§Mua" nltica" name="" arra arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>nAAĮAAAAAA430097419635Dy)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/ame="" arrayDimensio+s="" />sionsion/>nA¢¢¢AAA32771Dy)y’pe¾ si/> ion/>nA¢¢¢AAA32219729Dy)y’pe> sin/>nAAĮAAAAAA430097419635Dy)ype> sin/>§§§§§M‹žŻßnltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>ny)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>ny)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>ny)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>ny)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>ny)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>ny)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>ny)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sinef type=""sequenceMaxmension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>ny)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>nAAĮAAAAAA860194839271Dy)ype> sin/>§§§§§Mua" nltica" name="" arra arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>nAAĮAAAAAA430097419635Dy)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>nAAĮAAAAAA860194839271Dy)ype> sin/>§§§§§Mua" naxLengt:="-0a" name="" aņrayDimensions="" />nAAĮA’ sionsion/>nA¢¢¢AAA3Dy)edef type=""sequenceMaxLength="-255§§§§§Multua" name="" arrayDimensnons="" />sions]on/>nA¢¢¢AAA1Dy)y’p’’’’’’’’def type=""sequenceMaxLength="(255§§§§§Multica" name="" arrayDimensions="" />sin/>§§§§§Muname="" arrayDimension="" />sin/>§§§§§Mua" nltica" name="" arra arrayDImension="" />"-4295000065§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>ny)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>ny)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>ny)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>ny)ype> sin/>§§§§§Mua" nltica" name="" arrayDi>sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/ame="" arrayDimensio+s="" />sionsion/>nA¢¢¢AAA32771Dy)y’pe¾ si/> ion/>nA¢¢¢AAA32219729Dy)y’pe> sin/>nAAĮAAAAAA430097419635Dy)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>ny)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>ny)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>ny)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>ny)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>ny)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>ny)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>ny)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>nA¢¢¢AAA2Dy)y’p ’’’’’’def type=""sequenceMaxmension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>ny)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>nAAĮAAAAAA860194839271Dy)ype> sin/>§§§§§Mua" nltica" name="" arra arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>nAAĮAAAAAA430097419635Dy)ype> sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/ame="" arrayDimensio+s="" />sionsion/>nA¢¢¢AAA0DA¢¢¢AAA>’撒’’’’y)y’pe¾ si/> type=""sequenceMaxLength="(-238§§§§§Multica" name="" arrayDimensions=""¶/>sin/>§§§§sion/>n>’撒’’’’ \ No newline at end of file