[FFmpeg-devel] [PATCH] Do not fail DVB sub decoding because of a few padding bytes

Janne Grunau janne-ffmpeg
Tue Feb 8 23:10:28 CET 2011


On Sun, Feb 06, 2011 at 03:32:16PM +0100, Reimar D?ffinger wrote:
> Instead of returning an error when bytes are left over, just return
> the number of actually used bytes as other decoders do.
> Instead add a special case so an error will be returned when none
> of the data looks valid to avoid making debugging a pain.

Do you have a sample which triggers this? I assume this happens only on
broken packets and not on all packets in broken stream.

> ---
>  libavcodec/dvbsubdec.c |    9 ++-------
>  1 files changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
> index fe98798..7b761e0 100644
> --- a/libavcodec/dvbsubdec.c
> +++ b/libavcodec/dvbsubdec.c
> @@ -1423,7 +1423,7 @@ static int dvbsub_decode(AVCodecContext *avctx,
>  
>  #endif
>  
> -    if (buf_size <= 2)
> +    if (buf_size <= 2 || *buf != 0x0f)
>          return -1;
>  
>      p = buf;
> @@ -1467,12 +1467,7 @@ static int dvbsub_decode(AVCodecContext *avctx,
>          p += segment_length;
>      }
>  
> -    if (p != p_end) {
> -        av_dlog(avctx, "Junk at end of packet\n");
> -        return -1;
> -    }
> -
> -    return buf_size;
> +    return p - buf;
>  }
>  
>  
patch is ok

Janne



More information about the ffmpeg-devel mailing list