different segfault with lastest master

Dirk Hohndel dirk at hohndel.org
Mon Jul 13 14:36:03 PDT 2015


On Mon, Jul 13, 2015 at 01:58:25PM -0700, Linus Torvalds wrote:
> On Mon, Jul 13, 2015 at 1:39 PM, Dirk Hohndel <dirk at hohndel.org> wrote:
> >
> > The idea is that the taxomony should always be consistent. NULL pointer
> > and nothing there, or .nr in sync with the number of valid pointers.
> 
> Yes, yes. But if that initialization never happens, then you may have
> several *old* taxonomy values in there. "nr" is in sync with the
> number of valid pointers, that's not the problem.
> 
> The problem is that "nr" is not necessarily 0 or 1, because we may
> have *previous* taxonomy data, and we keep potentially growing it.

I think I understand it now... this would be a really hard to hit bug. You
have to load the taxonomy data for the same dive a second time, and the
second time the first call times out or fails (therefore you don't reset
the data), but the second call (oceans) completes. And then, indeed, if
you do this one more times and once again the first one fails and the
second one succeeds, then you write past the end of the list.

I hadn't considered that part. Thanks for pointing this possibility out.

Your patch prevents the problem but I'd like to try a different fix that
doesn't discard what we got back from the API.

/D


More information about the subsurface mailing list