[FFmpeg-devel] [PATCH] check for invalid roq decoding (issue 2521)

Michael Niedermayer michaelni
Mon Jan 10 01:58:11 CET 2011


On Sun, Jan 09, 2011 at 05:59:34PM -0500, Daniel Kang wrote:
> ffmpeg does not check for invalid decoding (motion vector I believe)
> when decoding roq files. The patch attached adds a check for this. As
> with the fix for issue 2513 (r26279), ffmpeg will continue to decode
> when it encounters this error.

>  roqvideo.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 9500ce3dabb508b67dad1f6a34b83fa4be1f8d0b  roq_invalid_decode_check.diff
> From 94559de1e80e66baf7cd8a803313b114d481825a Mon Sep 17 00:00:00 2001
> From: Daniel Kang <daniel.d.kang at gmail.com>
> Date: Sun, 9 Jan 2011 17:44:09 -0500
> Subject: [PATCH] Add check for invalid decode type
> 
> ---
>  libavcodec/roqvideo.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/libavcodec/roqvideo.c b/libavcodec/roqvideo.c
> index 830eb7b..bddd542 100644
> --- a/libavcodec/roqvideo.c
> +++ b/libavcodec/roqvideo.c
> @@ -118,6 +118,10 @@ static inline void apply_motion_generic(RoqContext *ri, int x, int y, int deltax
>      for(cp = 0; cp < 3; cp++) {
>          int outstride = ri->current_frame->linesize[cp];
>          int instride  = ri->last_frame   ->linesize[cp];
> +        if (ri->last_frame->data[cp] == NULL) {
> +            av_log(NULL, AV_LOG_ERROR, "Invalid decode type. Invalid header?\n");
> +            return;
> +        }

if one of them is 0 the others are 0 too

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110110/2ef040cc/attachment.pgp>



More information about the ffmpeg-devel mailing list