[FFmpeg-devel] [PATCH] Add and use av_fast_padded_malloc.

Michael Niedermayer michaelni at gmx.at
Sun Jan 15 22:10:00 CET 2012

On Sun, Jan 15, 2012 at 09:52:22PM +0100, Reimar Döffinger wrote:
> The same as av_fast_malloc but uses av_mallocz and keeps extra
> always-0 padding.
> This does not mean the memory will be 0-initialized after each call,
> but actually only after each growth of the buffer.
> However this makes sure that
> a) all data anywhere in the buffer is always initialized
> b) the padding is always 0
> c) the user does not have to bother with adding the padding themselves
> Fixes another valgrind warning about use of uninitialized data,
> this time with fate-vsynth1-jpegls.
> +void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
> +{
> +    if (!ff_fast_malloc(ptr, size, min_size + FF_INPUT_BUFFER_PADDING_SIZE, 1))
> +        memset(ptr + min_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);

possible integer overflow, except that i like this patch alot more than
the last

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Incandescent light bulbs waste a lot of energy as heat so the EU forbids them.
Their replacement, compact fluorescent lamps, much more expensive, dont fit in
many old lamps, flicker, contain toxic mercury, produce a fraction of the light
that is claimed and in a unnatural spectrum rendering colors different than
in natural light. Ah and we now need to turn the heaters up more in winter to
compensate the lower wasted heat. Who wins? Not the environment, thats for sure
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120115/a35826b1/attachment.asc>

More information about the ffmpeg-devel mailing list