[ogg-dev] Fixing ogg vorbis corruption caused by bad metadata
Martin Leese
martin.leese at stanfordalumni.org
Tue Jul 21 20:47:06 PDT 2009
Adam Rosi-Kessel <adam at rosi-kessel.org> wrote:
> I finally got something like an explanation from the Mediamonkey
> developers. Here is their explanation as to why MM corrupted my files:
>
> > the problem was caused by the fact that Vorbis library uses alloca()
> > function on several places, which allocates memory on stack. We
> > changed it to alloc() and free() functions pair instead, which fixes
> > the problem. I suppose that it can easily happen to any other
> > application using Vorbis library, but the real problem depends on
> > stack settings of the particular application. In any case, I think it
> > might make sense for Vorbis developers to make this change.
>
> I'm not sure exactly what to make of this, but it sounds perhaps like a
> stack overflow issue?
I once got corruption similar to what you saw,
but in a non-audio setting. This was in back in
the 1990s. What happened was that I wrote
code that allocated memory to a pointer,
freed it, allocated memory to a second pointer,
but continued to use the first pointer. This
meant that two pointers were now both
pointing to the same chunk of memory.
One possibility is that MediaMonkey messed
up the free()s, like I did in the last century.
Anyway, calling alloc()s with no corresponding
free()s is a memory leak. Not good code.
Regards,
Martin
--
Martin J Leese
E-mail: martin.leese stanfordalumni.org
Web: http://members.tripod.com/martin_leese/
More information about the ogg-dev
mailing list