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

Fixing potential issues #15220

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fixing potential issues #15220

wants to merge 1 commit into from

Conversation

DoughIt
Copy link

@DoughIt DoughIt commented Dec 6, 2023

Hi there! We've embarked on a thorough examination of the Apollo project, utilizing static analysis tools to build a detailed history of code issues. This deep dive into the Apollo has revealed several key issues. Notably, we found that similar issues had been identified and resolved in other parts of the project, which highlights the problematic code's similarities and potential dangers. These lingering issues, we believe, significantly increase the risk of system crashes.

For reference to similar correction patterns, please see commit 42fb17e in the file modules/dreamview/backend/sim_control_manager/sim_control_manager.cc.

@CLAassistant
Copy link

CLAassistant commented Dec 6, 2023

CLA assistant check
All committers have signed the CLA.

@daohu527
Copy link
Contributor

daohu527 commented Dec 7, 2023

@DoughIt Thank you for your suggestion. I want to know the details. Are we just using the scanning tool, or do we understand the code? I found that some places are not so reasonable.

For example, you can explain the problems based on examples, or classify the problems

@DoughIt
Copy link
Author

DoughIt commented Dec 7, 2023

Thank you for your response! We did not attempt to understand the complete business code but explored some historical fixed cases, thereby inferring whether there are noteworthy issues among the residual.

First, let's illustrate with a specific example. In commit 215f988, we noticed that in the file modules/dreamview/backend/sim_control_manager/sim_control_manager.cc, at line 56, a new condition was added to check whether model_ptr_ is a non-null pointer. If it's not null, the Stop() method would be called. However, the logic here seems to have been inverted. The condition actually returns true when model_ptr_ is a nullpointer, and attempting to execute model_ptr_->Stop() in this case leads to a null pointer dereference issue.

This issue was later fixed in commit 42fb17e (see the screenshot below).

From these fixed patterns, we infer that similar issues in the code are likely to cause problems in the future and then get fixed. For example, in this pr, as shown in the screenshot below, at line 98, even after confirming that model_ptr_ is null, the code still attempts to execute the model_ptr_->Stop() method, which could trigger a null pointer exception.

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.

None yet

3 participants