Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the bug
While testing, we found that the prediction module sometimes crashed due to out-of-range access. The log of the prediction module is as follows.
System information
OS Platform and Distribution: Ubuntu 18.04
Apollo installed from (source or binary): source
Apollo version : master (master branch -commit e373b20)
To Reproduce
The cyber record link: https://drive.google.com/file/d/1fgo5Tz2XXT8VTuH2FazXTdXe-lRcLSWn/view?usp=sharing
Additional context
We found that the crash occurred in function
JointlyPredictionPlanningEvaluator::ExtractADCTrajectory
.When the size of the input
trajectory_points
is 0, when accessing thetrajectory_points- >at(i).path_point().x()
at line 547 (the i is 0), an out_of_range error occurs and causes a crash.Further, we found that the
JointlyPredictionPlanningEvaluator::Evaluate
function incorrectly calledExtractADCTrajectory
, which caused the crash. When the size ofadc_traj.trajectory_point()
is 1, the judgment on line 328 can be passed, but the size ofadc_traj_curr_pos
will be 0, causing the above crash.Solution
Therefore, we recommend setting the threshold for judgment on line 328 to 2. This modification can avoid the above errors and will not affect the functionality of thisfunction.