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 two asan detected memory bugs #329

Merged
merged 1 commit into from
Jun 10, 2022

Conversation

liuliu
Copy link
Contributor

@liuliu liuliu commented Jun 7, 2022

I am running through simulate.swift (my port of simulate.cc) with
address sanitizer to discover related bugs.

Besides ones in my port, there are two in MuJoCo:

  1. in maketext, the logic to find . is not protected against j is less
    than 0 (due to the decreasing logic above), creating out of bound
    access.

  2. in mj_printFormattedData, qfrc_applied should use length nv not nq,
    otherwise out of bound access could be triggered.

Test Plan:

Run through the simulate.cc with asan. Before this fix, when presenting
profiler view, it will trigger bug #1. When print data, it will trigger
bug #2. Both are using model/humanoid/22_humanoids.xml.

I am running through simulate.swift (my port of simulate.cc) with
address sanitizer to discover related bugs.

Besides ones in my port, there are two in MuJoCo:

1. in maketext, the logic to find . is not protected against j is less
   than 0 (due to the decreasing logic above), creating out of bound
   access.

2. in mj_printFormattedData, qfrc_applied should use length nv not nq,
   otherwise out of bound access could be triggered.

Test Plan:

Run through the simulate.cc with asan. Before this fix, when presenting
profiler view, it will trigger bug google-deepmind#1. When print data, it will trigger
bug google-deepmind#2. Both are using model/humanoid/22_humanoids.xml.
@yuvaltassa
Copy link
Collaborator

Thanks!

@copybara-service copybara-service bot merged commit d90d506 into google-deepmind:main Jun 10, 2022
@liuliu liuliu deleted the liu/fix-memory-issues branch June 10, 2022 16:57
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