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

Tristan Matthews le.businessman at gmail.com
Fri Dec 6 15:53:28 CET 2013


On Fri, Dec 6, 2013 at 5:03 AM, Rafaël Carré <funman at videolan.org> wrote:
> 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?

Ah, nice one. That fixes the issue and is definitely less hacky.

>
> 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. */
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel



-- 
Tristan Matthews
web: http://tristanswork.blogspot.com



More information about the vlc-devel mailing list