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

INTEGRATION_thruster has undefined behavior potentially causing test flakiness #2291

Closed
azeey opened this issue Jan 17, 2024 · 4 comments · Fixed by #2350
Closed

INTEGRATION_thruster has undefined behavior potentially causing test flakiness #2291

azeey opened this issue Jan 17, 2024 · 4 comments · Fixed by #2350
Assignees
Labels
bug Something isn't working good first issue Good for newcomers help wanted We accept pull requests!

Comments

@azeey
Copy link
Contributor

azeey commented Jan 17, 2024

Environment

  • OS Version: Ubuntu 22.04
  • Source or binary build? gz-sim7, 926923f

Description

  • Expected behavior: Code has no undefined behaviors
  • Actual behavior: std::vector::back is potentially called on an empty vector in multiple places. This is regarded as undefined behavior. For example:
    modelPoses.clear();
    propellerAngVels.clear();
    propellerLinVels.clear();
    // Make sure that when the deadband is disabled
    // commands below the deadband should create a movement
    auto latest_pose = modelPoses.back();

The vector modelPoses is cleared followed by auto latest_pose = modelPoses.back();

@azeey azeey added the bug Something isn't working label Jan 17, 2024
@azeey azeey moved this from Inbox to To do in Core development Jan 22, 2024
@azeey azeey added help wanted We accept pull requests! good first issue Good for newcomers labels Jan 22, 2024
@GauravKumar9920
Copy link
Contributor

can I work on this issue ?

@azeey
Copy link
Contributor Author

azeey commented Feb 14, 2024

Yes, please!

@GauravKumar9920
Copy link
Contributor

hii, upon running the code check I found that this issue is persistent among many other similar files, like detachable_joint.cc, WindEffects.cc and many others, shall I fix most of them or just this one(thruster.cc) ?

@azeey
Copy link
Contributor Author

azeey commented Feb 15, 2024

Hi @GauravKumar9920, this issue is not about code style, but that accessing std::vector::back on an empty vector could cause a crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted We accept pull requests!
Projects
Archived in project
2 participants