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

Bugfix/parsing wrong vector yields segfault #1

Merged

Conversation

MCFurry
Copy link
Member

@MCFurry MCFurry commented Jan 5, 2023

Aha! So it seems we did introduce a segfault ourselves!

jspricke and others added 7 commits May 31, 2022 09:26
Previously the documentation mistakenly stated the argument `h` was used for getting the `diagnostic_period` parameter. I fixed the documentation.
The data returned from a socket is `bytes`. So to properly deal with
this data we'd have to concatenate as bytes and decode to string at the
end.

The old (wrong) way of concatenating results in some stray `'b'`
characters showing up in the drive names.
@@ -278,7 +278,8 @@ void Aggregator::publishData()
{
diag_array.status.push_back(*processed_other[i]);

const uint depth = static_cast<uint>(std::count(processed[i]->name.begin(), processed[i]->name.end(), '/'));
Copy link
Member Author

Choose a reason for hiding this comment

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

Here is the actual fix, the rest is a sync with the forked remote repo

Choose a reason for hiding this comment

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

TBH; I don't know what the implications of this change are down the line since I don't know the inner workings of this code. But I agree that this looks like a bug.

Copy link
Member Author

Choose a reason for hiding this comment

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

Now something useful happens since we access elements from the vector we are actually looping through. Before we didn't and that could potentially throw a segfault...
So this change prevents a segfault and also makes sure we actually report something useful ;-)

@@ -278,7 +278,8 @@ void Aggregator::publishData()
{
diag_array.status.push_back(*processed_other[i]);

const uint depth = static_cast<uint>(std::count(processed[i]->name.begin(), processed[i]->name.end(), '/'));

Choose a reason for hiding this comment

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

TBH; I don't know what the implications of this change are down the line since I don't know the inner workings of this code. But I agree that this looks like a bug.

@rokusottervanger
Copy link
Collaborator

Are you planning on opening a PR for this to the upstream repo?

@MCFurry
Copy link
Member Author

MCFurry commented Jan 6, 2023

Are you planning on opening a PR for this to the upstream repo?

Already pending for quite a while: ros#197

@MCFurry MCFurry merged commit 14d2d79 into nobleo-noetic-devel Jan 6, 2023
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.

8 participants