[vlc-devel] [PATCH] araw: fix passthrough copying

Rémi Denis-Courmont remi at remlab.net
Tue Nov 12 10:11:33 CET 2013


On Sun, 10 Nov 2013 11:29:00 -0500, Tristan Matthews
<le.businessman at gmail.com> wrote:
> Fixes #9343 where in->i_buffer is greater than in->i_nb_samples *
> sizeof(frame).
> ---
>  modules/codec/araw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/modules/codec/araw.c b/modules/codec/araw.c
> index 0d5c300..d4bd4b0 100644
> --- a/modules/codec/araw.c
> +++ b/modules/codec/araw.c
> @@ -739,7 +739,7 @@ static block_t *Encode( encoder_t *enc, block_t *in
)
>          encode( out->p_buffer, in->p_buffer, in->i_nb_samples
>                                               *
>                                              
enc->fmt_out.audio.i_channels
>                                               );
>      else
> -        memcpy( out->p_buffer, in->p_buffer, in->i_buffer );
> +        memcpy( out->p_buffer, in->p_buffer, out->i_buffer );

I really doubt this will work. Audio filters and outputs generally assume
that the block size (i_buffer) matches the block samples count
(i_nb_samples). The pass-through encoder is only one of many components
that gets decoded audio blocks as input.

In other words, you should rather fix whatever (decoder?) is generating
corrupt audio blocks. You may want to add an assertion to araw.c
regardless.

>      return out;
>  }

-- 
Rémi Denis-Courmont
Sent from my collocated server



More information about the vlc-devel mailing list