Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[22101] Addres parseXMLMemberDynamicType regression (backport #5499) #5518

Open
wants to merge 1 commit into
base: 3.0.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 37 additions & 5 deletions src/cpp/xmlparser/XMLDynamicParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t> 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<uint32_t> 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)
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 @@ -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();
}

Expand Down
2 changes: 2 additions & 0 deletions test/unittest/xmlparser/regressions/22101_profile_bin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<profiles><topic pr="" />>>ÿ:ÿÿ<types><type> <typedef type="strigs"uqeÿÿÿ˜eMaxLengt:="-0a" name="" aòrayDimensions="" />n</type></types>AAÁAÿ<types><type> <typedef tyÿÿÿÿÿÿÿÿÿÿÿÿÿ="string"sequenceMaxLength="-1§§§§§Mua" name="" arrayDimensions="" />sionsion/>n</type></types>A¢¢¢AAA3D<types><type>y)edef type=""sequenceMaxLength="-255§§§§§Multua" name="" arrayDimensnons="" />sions]on/>n</type></types>A¢¢¢AAA1D<types><type>y)yÿpÿÿÿÿÿÿÿÿdef type=""sequenceMaxLength="(255§§§§§Multica" name="" arrayDimensions="" />sin/>§§§§§Mua" n/>n</type></types>A¢¢¢AAA3D<types><type>y)yÿpe> <typedef type=""sequenceMaxLength="-1§§§§§Multica" name="" arrayDims="" />sionsion/>n</type></types>A¢¢¢AAA77407812D<types><type>y)yÿpe> <typedef type=""sequenceMaxLength="-255§§§§§Multica" name="" arrayDimensions="" />sin/>n</type></types>AAÁAAAAAA430097419635D<types><type>2/shm
ÿd-sC$@Cdtypee="string"sequenceMaxLength="-4295000065§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>n</type></types>A¢¢¢AAA1D<types><type>y)yÿpÿÿÿÿÿÿÿÿdef type=""sequenceMaxmension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>n</type><type>y)ype> <typedef type="string"sequenceMaxLength="-32769§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>n</type></types>AAÁAAAAAA860194839271D<types><type>y)ype> <typedef type="string"sequenceMaxLength="-128§§§§§Multica" name="" arrayDimension="" />sin/>§§§§§Mua" nltica" name="" arra arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>n</type></types>AAÁAAAAAA430097419635D<types><type>y)ype> <typedef type="string"sequenceMaxLength="-256§§§§§Multica" data_writerrayDimension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>n</type></types>AAÁAAAAAA860194839271D<types><type>y)ype> <typedef type="string"sequenceMaxLength="-255§§§§§Multi§§§Multica" name="" arrayDimension="" />sin/>§§§§§Mua" naxLengt:="-0a" name="" aòrayDimensions="" />n</type></types>AAÁAÿ<types><type> <typedef tyÿÿÿÿÿÿÿÿÿÿÿÿÿ="string"sequenceMaxLength="-1§§§§§Mua" name="" arrayDimensions="" />sionsion/>n</type></types>A¢¢¢AAA3D<types><type>y)edef type=""sequenceMaxLength="-255§§§§§Multua" name="" arrayDimensnons="" />sions]on/>n</type></types>A¢¢¢AAA1D<types><type>y)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/>n</type></types>AAÁAAAAAA430097419635D<types><type>y)ype> <typedef type="string"sequenceMaxLength="-256§§§§§Multica" name="B" arrayDimension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/ame="" arrayDimensio+s="" />sionsion/>n</type></types><profiles>A¢¢¢AAA32771D</profiles><types><type>y)yÿpe¾ <typedef type=""sequencenceMaxLength="-255§§§§§Multica" name="" arrayDimensions="" />si/> ion/>n</type></types>A¢¢¢AAA32219729D<types><type>y)yÿpe> <typedef type=""sequenceMaxLength="-256§§§§§Multica" name="" arrayDimensions="" />sin/>n</type></types>AAÁAAAAAA430097419635D<types><type>y)ype> <typedef type="string"sequenceMaxLength="-4295000065§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§M‹žÝßnltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>n</type></types><types><type>y)ype> <typedef type="string"sequenceMaxLength="-4295000065§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>n</type></types><types><type>y)ype> <typedef type="string"sequenceMaxLength="-4295000065§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>n</type></types><types><type>y)ype> <typedef type="string"sequenceMaxLength="-4295000065§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>n</type></types><types><type>y)ype> <typedef type="string"sequenceMaxLength="-4295000065§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>n</type></types><types><type>y)ype> <typedef type="string"sdquenceMaxLength="-4295000065§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>n</type></types><types><type>y)ype> <typedef type="string"sequenceMaxLength="-4295000065§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>n</type></types><types><type>y)ype> <typedef type="string"sequenceMaxLength="-4295000065§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sinef type=""sequenceMaxmension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>n</type><type>y)ype> <typedef type="string"sequenceMaxLength="-32769§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>n</type></types>AAÁAAAAAA860194839271D<types><type>y)ype> <typedef type="string"sequenceMaxLength="-128§§§§§Multica" name="" arrayDimension="" />sin/>§§§§§Mua" nltica" name="" arra arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>n</type></types>AAÁAAAAAA430097419635D<types><type>y)ype> <typedef type="string"sequenceMaxLength="-256§§§§§Multica" name="B" arrayDimension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>n</type></types>AAÁAAAAAA860194839271D<types><type>y)ype> <typedef type="string"sequenceMaxLength="-255§§§§§Multi§§§Multica" name="" arrayDimension="" />sin/>§§§§§Mua" naxLengt:="-0a" name="" aòrayDimensions="" />n</type></types>AAÁAÿ<types><type> <typedef tyÿÿÿÿÿÿÿÿÿÿÿÿÿ="string"sequenceMaxLength="-1§§§§§Mua" name="" arrayDimensions="" />sionsion/>n</type></types>A¢¢¢AAA3D<types><type>y)edef type=""sequenceMaxLength="-255§§§§§Multua" name="" arrayDimensnons="" />sions]on/>n</type></types>A¢¢¢AAA1D<types><type>y)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/>n</type></types><types><type>y)ype> <typedef type="string"sequenceMaxLength="-4295000065§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>n</type></types><types><type>y)ype> <typedef type="string"sequenceMaxLength="-4295000065§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>n</type></types><types><type>y)ype> <typedef type="string"sequenceMaxLength="-4295000065§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>n</type></types><types><type>y)ype> <typedef type="string"sequenceMaxLength="-4295000065§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDi>sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/ame="" arrayDimensio+s="" />sionsion/>n</type></types><profiles>A¢¢¢AAA32771D</profiles><types><type>y)yÿpe¾ <typedef type=""sequencenceMaxLength="-255§§§§§Multica" name="" arrayDimensions="" />si/> ion/>n</type></types>A¢¢¢AAA32219729D<types><type>y)yÿpe> <typedef type=""sequenceMaxLength="-255§§§§§Multica" name="" arrayDimensions="" />sin/>n</type></types>AAÁAAAAAA430097419635D<types><type>y)ype> <typedef type="string"sequenceMaxLength="-4295000065§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>n</type></types><types><type>y)ype> <typedef type="string"sequenceMaxLength="-4295000065§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>n</type></types><types><type>y)ype> <typedef type="string"sequenceMaxLength="-4295000065§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>n</type></types><types><type>y)ype> <typedef type="string"sequenceMaxLength="-4295000065§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>n</type></types><types><type>y)ype> <typedef type="string"sequenceMaxLength="-4295000065§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>n</type></types><types><type>y)ype> <typedef type="string"sequenceMaxLength="-0§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>n</type></types><types><type>y)ype> <typedef type="string"sequenceMaxLength="-4295000066§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>n</type></types><types><type>y)ype> <typedef type="string"sequenceMaxLength="-4295000065§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" /rrayDimensnons="" />sions]on/>n</type></types>A¢¢¢AAA2D<types><type>y)yÿp ÿÿÿÿÿÿdef type=""sequenceMaxmension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>n</type><type>y)ype> <typedef type="string"sequenceMaxLength="-32769§§§§§Multica" name="" arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>n</type></types>AAÁAAAAAA860194839271D<types><type>y)ype> <typedef type="string"sequenceMaxLength="-24971358§§§§§Multica" name="" arrayDimension="" />sin/>§§§§§Mua" nltica" name="" arra arrayDImension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/>ca" name="" />sin/>n</type></types>AAÁAAAAAA430097419635D<types><type>y)ype> <typedef type="string"sequenceMaxLength="-255§§§§§Multica" name="B" arrayDimension="" />sin/>§§§§§Mua" nltica" name="" arrayDimension="" />sin/ame="" arrayDimensio+s="" />sionsion/>n</type></types><profiles>A¢¢¢AAA0D</profiles><types><profiles>A¢¢¢AAA>ÿ¿’’’’’’</profiles></types><type>y)yÿpe¾ <typedef type=""sequencenceMaxLength="-255§§§§§Multica" name="" arrayDimensions="" />si/> type=""sequenceMaxLength="(-238§§§§§Multica" name="" arrayDimensions=""¶/>sin/>§§§§sion/>n</type><type>>ÿ¿’’’’’’</type></profiles>
Loading