crash with master when plotting the profile

Linus Torvalds torvalds at
Mon Jan 7 15:14:13 PST 2013

On Mon, Jan 7, 2013 at 2:54 PM, Linus Torvalds
<torvalds at> wrote:
> Will look at it.

Ok, I see why it happens: we create too few plot entries for the
samples and the maxtime. I think it has to do with time going
backwards in the samples: the magic is your time choice of time
samples of 5, 10 and _3_ minutes. Not "+3".

So what happens is that time goes backwards, we continue using up more
plot entries, and our "number of plot entries needed" estimation
(maxtime/10+1) turns out to be too small.

Now, how to *fix* it is another matter. Do we really want to be able
to plot dives that go back-and-forth in time? If so, we need to make
that plot info entry allocation much more intelligent.

Of course, it would probably be better if the planner just didn't
allow segments that go backwards in time.

In the meantime, here's a patch to the profile code that just says "if
the sample time goes backwards, just stay where you are". That fixes
the memory corruption by not allowing the plot entries to be

It's more of a bandaid than anything, but I guess it's a good
band-aid. Feel free to add my sign-off..

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: application/octet-stream
Size: 508 bytes
Desc: not available
URL: <>

More information about the subsurface mailing list