On Wed,  8 Jan 2014 03:25:33 +0100, Luca Barbato <[email protected]> wrote:
> From: Marton Balint <[email protected]>
> 
> Without this fix the last sample was missing from the packet.
> ---
>  libavformat/mxfdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> index 8f17fa1..ea5ba58 100644
> --- a/libavformat/mxfdec.c
> +++ b/libavformat/mxfdec.c
> @@ -312,7 +312,7 @@ static int mxf_get_d10_aes3_packet(AVIOContext *pb, 
> AVStream *st, AVPacket *pkt,
>      data_ptr = pkt->data;
>      end_ptr = pkt->data + length;
>      buf_ptr = pkt->data + 4; /* skip SMPTE 331M header */
> -    for (; buf_ptr + st->codec->channels*4 < end_ptr; ) {
> +    for (; buf_ptr + st->codec->channels * 4 <= end_ptr; ) {

I suppose the change is ok.

The code is wrong though, it constructs a possibly invalid pointer. It should
instead check the difference between end_ptr and buf_ptr being sufficiently
large. Feel free to fix that if you have time/motivation.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to