mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix array underrun when calculating velocity
That code is messy. And it was buggy. Noticed by valgrind. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
74988c86de
commit
fcc7a01c6e
1 changed files with 1 additions and 1 deletions
|
@ -620,7 +620,7 @@ static struct plot_info *analyze_plot_info(struct plot_info *pi)
|
|||
/* if our samples are short and we aren't too FAST*/
|
||||
if (entry[0].sec - entry[-1].sec < 30 && entry->velocity < FAST) {
|
||||
int past = -2;
|
||||
while (pi->entry <= entry-past && entry[0].sec - entry[past].sec < 30)
|
||||
while (i+past > 0 && entry[0].sec - entry[past].sec < 30)
|
||||
past--;
|
||||
entry->velocity = velocity((entry[0].val - entry[past].val) /
|
||||
(entry[0].sec - entry[past].sec));
|
||||
|
|
Loading…
Add table
Reference in a new issue