[ogg-dev] Fixing ogg vorbis corruption caused by bad metadata

Martin Leese martin.leese at stanfordalumni.org
Thu Jul 23 08:43:36 PDT 2009


On Wed, Jul 22, 2009 at 7:24 PM, Martin
Leese<martin.leese at stanfordalumni.org> wrote:

> Erik de Castro Lopo <mle+la at mega-nerd.com> wrote:
>
>> Martin Leese wrote:
>>> Anyway, calling alloc()s with no corresponding
>>> free()s is a memory leak.  Not good code.
>>
>> The alloca() function allocates space on the stack and
>> that allocation is automatically freed when the function
>> that did the allocation returns.
>>
>> The Linux man page is quite informative.
>
> Yes, but is your code intended to work only
> under Linux, and nowhere else?  What
> matters is what the C manual says, and C still
> has no automatic garbage collection.  It looks
> like Microsoft currently supports C90 (with only
> some of C99).

I appear to be spouting nonsense again.  I
should know better than to offer advice about
coding when I have been out of it for so long.

However, there is a general point.  Xiph policy
now encourages cover art in VorbisComments
using the METADATA_BLOCK_PICTURE tag,
visit:
http://wiki.xiph.org/VorbisComment#Cover_art

This means that VorbisComments can be
huge, and so memory for them now needs to
be allocated from the heap, not the stack.

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