Stable release crashes on import

Linus Torvalds torvalds at linux-foundation.org
Sun Apr 10 21:30:29 PDT 2016


On Apr 10, 2016 21:09, "Miika Turkia" <miika.turkia at gmail.com> wrote:
>
> When importing the attached log file, the stable releases crash. I
> have not been able to figure out what is wrong (apart from apparent
> memory corruption). This seems to work on development version, but
> fails on the stable releases. Moreover, when I dump the imported log
> to a file before the crash, this log file opens up just fine.

So I found a buglet in copy_dive() when I was doing the git save
optimization, and fixed that there - when copying the first dc (the one
that is part of the struct dive) we wouldn't do the proper strdup() of the
dc model name. But when I looked at it, I decided it couldn't matter,
because we never free the fields of the first dc anyway.

But you do have copy_dive in your stack trace. Hmm..

The fix was to replace the open-coded sample/event copy calls after the
STRUCTURED_COPY_LIST() thing with a

   copy_dc(&s->dc, &d->dc);

before that STRUCTURED_COPY_LIST(), so that we copy the first dive computer
and then copy the list of secondary computers after that.

It mattered for my git save optimizations because my first version of that
also needed to invalidate the dc git cache when it did the copy. That never
made it to the final version, but the fix for copying the dc did. And you
do mention that the development version doesn't have this problem..

Have you tried running things under valgrind? That tends to be very good at
finding memory corruption bugs.

I'll try to take a look tomorrow and see, if nobody else gets to it.

    Linus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20160410/16297ed8/attachment.html>


More information about the subsurface mailing list