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

Fix rcl_parse_yaml_file() error handling. #776

Merged
merged 3 commits into from
Aug 31, 2020

Conversation

hidmic
Copy link
Contributor

@hidmic hidmic commented Aug 31, 2020

It should not fini its output argument, silently invalidating the given pointer.

CI up to rcl_yaml_param_parser and rcl:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

It should not fini its output argument,
silently invalidating the given pointer.

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Copy link
Contributor

@brawner brawner left a comment

Choose a reason for hiding this comment

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

Seems reasonable

Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

Can you please clarify the contract of this method in the header file? It's not clear to me whether this is what is expected by downstream consumers.

@hidmic
Copy link
Contributor Author

hidmic commented Aug 31, 2020

Can you please clarify the contract of this method in the header file? It's not clear to me whether this is what is expected by downstream consumers.

Sure, we can add one. Considering that rcl is the sole consumer of this API and that a test SIGABRT on a double free, I'd think this wasn't expected 😅

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
@hidmic
Copy link
Contributor Author

hidmic commented Aug 31, 2020

@clalancette does 1ebb39a make sense?

Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for the additional clarification here.

/// \brief Parse the YAML file, initialize and populate params_st
/// \brief Parse the YAML file and populate \p params_st
/// \pre Given \p params_st must be a valid parameter struct
/// as retured by `rcl_yaml_node_struct_init()`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// as retured by `rcl_yaml_node_struct_init()`
/// as returned by `rcl_yaml_node_struct_init()`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Argh... 🤦 See be78d0d. Wonder why my spell checker didn't catch it.

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
@hidmic
Copy link
Contributor Author

hidmic commented Aug 31, 2020

Alright, all green. Going in!

@hidmic hidmic merged commit 63c72e9 into master Aug 31, 2020
@hidmic hidmic deleted the hidmic/parse-should-not-fini branch August 31, 2020 19:56
@brawner
Copy link
Contributor

brawner commented Aug 31, 2020

Sorry I missed this, but this PR didn't adjust the unit tests to fix mem leaks. See #779

@brawner
Copy link
Contributor

brawner commented Sep 2, 2020

Will this need a backport? It changes API slightly. Backporting after I backport #754 will become much more difficult. However, not backporting this PR will cause a divergence that might introduce memory errors or leaks.

hidmic added a commit that referenced this pull request Sep 2, 2020
It should not fini its output argument, silently invalidating the given pointer.

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
hidmic added a commit that referenced this pull request Sep 24, 2020
It should not fini its output argument, silently invalidating the given pointer.

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants