[vlc-devel] [PATCH] flac: frame_size shouldn't exceed input buffer size

Rafaël Carré funman at videolan.org
Fri Dec 6 11:03:19 CET 2013


Hi,

Le 06/12/2013 06:34, Tristan Matthews a écrit :
> Fixes #9966
> ---
>  modules/packetizer/flac.c | 1 +
>  1 file changed, 1 insertions(+)
> 
> diff --git a/modules/packetizer/flac.c b/modules/packetizer/flac.c
> index 2f16717..39174ef 100644
> --- a/modules/packetizer/flac.c
> +++ b/modules/packetizer/flac.c
> @@ -571,6 +571,7 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
>          p_sys->i_state = STATE_NEXT_SYNC;
>          p_sys->i_frame_size = p_sys->b_stream_info && p_sys->stream_info.min_framesize > 0 ?
>                                                          p_sys->stream_info.min_framesize : 1;
> +        p_sys->i_frame_size = __MIN( p_sys->i_frame_size, in->i_buffer );

Looks good but I don't like that we work around a limitation / misuse of
the block_helper.h API.

Perhaps we can defer the CRC calculation inside STATE_NEXT_SYNC, when we
have got at least p_sys->i_frame_size bytes?

I think with this patch we could send back a frame smaller than the
minimal framesize (although it would be weird that it has a correct CRC).

>          /* Calculate the initial CRC for the minimal frame size,
>           * We'll update it as we look for the next start code. */



More information about the vlc-devel mailing list