Skip to content

Commit

Permalink
Address XMLDynamicParser regression (#5383)
Browse files Browse the repository at this point in the history
* Refs #22054: Add Regression test

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #22054: Add fix

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

---------

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
(cherry picked from commit fe29535)
  • Loading branch information
Mario-DL authored and mergify[bot] committed Nov 6, 2024
1 parent c230154 commit bd08f14
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/cpp/xmlparser/XMLDynamicParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,16 @@ XMLP_ret XMLParser::parseXMLBitsetDynamicType(
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_BITSET == parent_type->get_kind() ||
TK_BITSET ==
traits<DynamicType>::narrow<DynamicTypeImpl>(parent_type)->resolve_alias_enclosed_type()->get_kind()))
Expand Down
1 change: 1 addition & 0 deletions test/unittest/xmlparser/XMLParserTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ TEST_F(XMLParserTests, regressions)
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));
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));
Log::Flush();
}

Expand Down
1 change: 1 addition & 0 deletions test/unittest/xmlparser/regressions/22054_profile_bin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<types><type><bitset name="]" baseType="`/d" /></type></types>

0 comments on commit bd08f14

Please sign in to comment.