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

[BUG] Consistent and critical failure parsing large (>500 lines) YAML configuration files. #419

Closed
joncppl opened this issue Apr 22, 2019 · 3 comments · Fixed by #456
Closed
Assignees
Labels
bug Something isn't working

Comments

@joncppl
Copy link

joncppl commented Apr 22, 2019

Bug report

Required Info:

  • Operating System:
    • Ubuntu 18.04
  • Installation type:
    • Latest Crystal Binaries (also Docker Image)
  • Version or commit hash:
    • Crystal Patch 4
  • DDS implementation:
    • Fast-RTPS
  • Client library (if applicable):
    • both

Steps to reproduce issue

Make any yaml parameter file is very long

/:
  test:
    ros__parameters:
        param1: 0
        param2: 1
        # .... continue for about 500 lines

Run with any node

ros2 run examples_rclcpp_minimal_subscriber subscriber_member_function __params:=./bigyamlfile.yml

The same occurs with the python examples, and every node I've tried.

Expected behavior

Node load as normal with the parameters set.

Actual behavior

Critical Failure with corrupted size vs. prev_size during node construction.

Additional information

The abort comes during the call to yaml_parser_delete. https://github.com/ros2/rcl/blob/master/rcl_yaml_param_parser/src/parser.c#L1384

I think that libyaml's parser object is somehow getting corrupted.

I have succeeded in parsing such yaml files with libyaml (0.1.8), pyyaml, etc., with no issue.

@jacobperron jacobperron added the ready Work is about to start (Kanban column) label Apr 25, 2019
@joncppl
Copy link
Author

joncppl commented May 28, 2019

I was looking over this again and found that maximum parameters is a hard coded constant at 512.

This splits this issue into separate parts:

  1. still a bug imo - Parameter loading doesn't check against the maximum, allowing for write past end of buffer, hence the memory corruption issues I'm seeing.

  2. Likely an indepentend Feature request - max parameters would be configurable by some means, such as override by environment variable or an rcl method to set it. Maybe this is hard as the parameter buffer would need to be converted to dynamic memory.

  3. max parameters should be documented somewhere so others dont go through the frustration I have.

@jacobperron jacobperron added bug Something isn't working and removed ready Work is about to start (Kanban column) labels May 28, 2019
@kekstee
Copy link

kekstee commented Jun 5, 2019

There's a related issue concerning the other hardcoded lengths in the parser: #244

@jacobperron jacobperron self-assigned this Jun 6, 2019
jacobperron added a commit that referenced this issue Jun 7, 2019
If the maximum number is exceeded fail with an informative error message.

Fixes #419.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
@jacobperron
Copy link
Member

I've added a guard against the memory corruption and an informative error message In #456.

I think we can re-phrase #244 to be about letting users configure the currently hard-coded limits.

jacobperron added a commit that referenced this issue Jun 7, 2019
…456)

If the maximum number is exceeded fail with an informative error message.

Fixes #419.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
clalancette pushed a commit that referenced this issue Jun 12, 2019
…456)

If the maximum number is exceeded fail with an informative error message.

Fixes #419.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
clalancette pushed a commit that referenced this issue Jun 12, 2019
…456)

If the maximum number is exceeded fail with an informative error message.

Fixes #419.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants