mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
planner: avoid out-of-bounds access
When exiting the loop, stopidx is 0, which means that if there are no stoplevels, stoplevels[stopidx + 1] generates an out-of-bounds access. Instead, suppose a stop at 3m or 10ft. Suggested-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
687f65bf77
commit
d7ca0c7253
1 changed files with 1 additions and 1 deletions
|
@ -1087,7 +1087,7 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
|
|||
* otherwise odd things can happen, such as CVA causing the final ascent to start *later*
|
||||
* if the ascent rate is slower, which is completely nonsensical.
|
||||
* Assume final ascent takes 20s, which is the time taken to ascend at 9m/min from 3m */
|
||||
ds->deco_time = clock - bottom_time - stoplevels[stopidx + 1] / last_ascend_rate + 20;
|
||||
ds->deco_time = clock - bottom_time - (M_OR_FT(3,10) * ( prefs.last_stop ? 2 : 1)) / last_ascend_rate + 20;
|
||||
} while (!is_final_plan);
|
||||
decostoptable[decostopcounter].depth = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue