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 potential UB in LTV controllers #5141

Closed
wants to merge 2 commits into from

Conversation

virtuald
Copy link
Member

  • If the constructor arguments are incorrect, the table will have zero entries, which will access invalid iterators in interpolating_map::operator[]

Only bad usages of #5139 I could see

- If the constructor arguments are incorrect, the table will have zero entries, which will access invalid iterators in interpolating_map::operator[]
@virtuald virtuald requested review from PeterJohnson and a team as code owners February 26, 2023 08:03
@virtuald
Copy link
Member Author

/format

@calcmogul
Copy link
Member

This change should be made in Java as well.

@calcmogul
Copy link
Member

calcmogul commented Feb 26, 2023

I'm guessing what happened is you gave a random 2x2 linear system that had a zero or negative steady-state velocity (maxV <= 0). If that can be confirmed, we can mention that in the error message to make it more informative and throw the exception before the for loop.

@virtuald
Copy link
Member Author

I didn't run into this error, I just went looking for incorrect uses of std::*_bound

@calcmogul
Copy link
Member

calcmogul commented Feb 26, 2023

Well, I'd prefer to tell the user what actually caused the error. The interpolating map being empty is just a symptom of a violated precondition earlier in the constructor.

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