[FFmpeg-devel] [PATCH 0/7] ffmpeg: add a grow_array() helper function
Michael Niedermayer
michaelni
Mon Aug 16 20:00:25 CEST 2010
On Fri, Aug 13, 2010 at 08:28:12PM +0200, Aurelien Jacobs wrote:
> Ooops... I slightly messed up this patch serie.
> I forgot the first patch which adds a grow_array() function which is
> then used by all the following patches. Here it is.
> The rest of the serie changes each *[MAX_STREAMS] arrays from ffmpeg.c
> into a dynamically allocated array.
>
> Aurel
>
>
> diff --git a/ffmpeg.c b/ffmpeg.c
> index aec1f79..28ce27f 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -646,6 +646,23 @@ static int ffmpeg_exit(int ret)
> return ret;
> }
>
> +static void *grow_array(void *array, int elem_size, int *size, int new_size)
> +{
> + if (*size < new_size) {
> + uint8_t *tmp = av_realloc(array, new_size*elem_size);
integer overflow
also see ff_dynarray_add() and add notes that refer to it and back so changed
done to one can be checked if they would also be usefull to the other
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100816/8d751466/attachment.pgp>
More information about the ffmpeg-devel
mailing list