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

[20732] Fix some leaks in XML DynamicTypes Parser (backport #4717) #4734

Merged
merged 1 commit into from
May 24, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Apr 26, 2024

Description

This PR adds a regression test with the XML reported from OSS Fuzz, and performs the following two actions on every method parsing and registering a dynamic type:

#. Doing a pre-check on whether a type with the same name is already registered in the profile manager, and perform an early return in that case
#. Tell DynamicTypeBuilderFactory to delete the builder when a call to XMLProfileManager::insertDynamicTypeByName fails.

@Mergifyio backport 2.13.x 2.10.x 2.6.x

Contributor Checklist

  • Commit messages follow the project guidelines.

  • The code follows the style guidelines of this project.

  • Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added; the added tests pass locally

  • N/A Any new/modified methods have been properly documented using Doxygen.

  • N/A Any new configuration API has an equivalent XML API (with the corresponding XSD extension)

  • Changes are ABI compatible.

  • Changes are API compatible.

  • N/A New feature has been added to the versions.md file (if applicable).

  • N/A New feature has been documented/Current behavior is correctly described in the documentation.

  • Applicable backports have been included in the description.

Reviewer Checklist

  • The PR has a milestone assigned.
  • The title and description correctly express the PR's purpose.
  • Check contributor checklist is correct.
  • Check CI results: changes do not issue any warning.
  • Check CI results: failing tests are unrelated with the changes.

This is an automatic backport of pull request #4717 done by [Mergify](https://mergify.com).

@mergify mergify bot added the conflicts Backport PR wich git cherry pick failed label Apr 26, 2024
Copy link
Contributor Author

mergify bot commented Apr 26, 2024

Cherry-pick of 8cb447b has failed:

On branch mergify/bp/2.13.x/pr-4717
Your branch is up to date with 'origin/2.13.x'.

You are currently cherry-picking commit 8cb447bb2.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   include/fastrtps/xmlparser/XMLProfileManager.h
	modified:   src/cpp/rtps/xmlparser/XMLDynamicParser.cpp
	modified:   src/cpp/rtps/xmlparser/XMLProfileManager.cpp
	new file:   test/unittest/xmlparser/regressions/20732_profile_bin.xml

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   test/unittest/xmlparser/XMLParserTests.cpp

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@MiguelCompany MiguelCompany added this to the v2.13.5 milestone Apr 26, 2024
* Refs #20732. Add regression test.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #20732. Fixes on parseXMLAliasDynamicType.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #20732. Fixes on parseXMLBitsetDynamicType.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #20732. Fixes on parseXMLBitmaskDynamicType.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #20732. Fixes on parseXMLEnumDynamicType.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #20732. Fixes on parseXMLStructDynamicType.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #20732. Fixes on parseXMLUnionDynamicType.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #20372. Return error when `insertDynamicTypeByName` fails.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #20372. Fail parsing for empty name attributes.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #20732. Move implementation of `DeleteInstance` to source file.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #20732. Delete registered dynamic type builders in `XMLProfileManager::DeleteInstance()`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
(cherry picked from commit 8cb447b)
@JesusPoderoso JesusPoderoso removed the conflicts Backport PR wich git cherry pick failed label May 20, 2024
@JesusPoderoso JesusPoderoso self-requested a review May 20, 2024 06:42
Copy link
Contributor

@JesusPoderoso JesusPoderoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with green CI

@github-actions github-actions bot added the ci-pending PR which CI is running label May 20, 2024
@JesusPoderoso
Copy link
Contributor

@richiprosima please test this

@JesusPoderoso
Copy link
Contributor

CI issues are unrelated to the PR
Ready to merge!

@JesusPoderoso JesusPoderoso added ready-to-merge Ready to be merged. CI and changes have been reviewed and approved. and removed ci-pending PR which CI is running labels May 23, 2024
@EduPonz EduPonz merged commit 57cceb6 into 2.13.x May 24, 2024
12 of 16 checks passed
@EduPonz EduPonz deleted the mergify/bp/2.13.x/pr-4717 branch May 24, 2024 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Ready to be merged. CI and changes have been reviewed and approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants