[FFmpeg-devel] [PATCH] avformat/tee: fix null pointer dereference

Nicolas George george at nsup.org
Mon Dec 16 10:51:03 CET 2013


Le tridi 23 frimaire, an CCXXII, Michael Niedermayer a écrit :
> Fixes CID1108584
> 
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
>  libavformat/tee.c |   14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/libavformat/tee.c b/libavformat/tee.c
> index 12ea0ea..e672cce 100644
> --- a/libavformat/tee.c
> +++ b/libavformat/tee.c
> @@ -397,6 +397,13 @@ static int filter_packet(void *log_ctx, AVPacket *pkt,
>                                               &new_pkt.data, &new_pkt.size,
>                                               pkt->data, pkt->size,
>                                               pkt->flags & AV_PKT_FLAG_KEY);
> +        if (ret < 0) {
> +            av_log(log_ctx, AV_LOG_ERROR,
> +                "Failed to filter bitstream with filter %s for stream %d in file '%s' with codec %s\n",
> +                bsf_ctx->filter->name, pkt->stream_index, fmt_ctx->filename,
> +                avcodec_get_name(enc_ctx->codec_id));
> +        }
> +

Stefano knows this part of the code better than me, but I suspect you need
to add a "break" after the log to preserve the current behaviour and not
simply ignore the error if it happens in any filter but the last.

>          if (ret == 0 && new_pkt.data != pkt->data && new_pkt.destruct) {
>              if ((ret = av_copy_packet(&new_pkt, pkt)) < 0)
>                  break;
> @@ -415,13 +422,6 @@ static int filter_packet(void *log_ctx, AVPacket *pkt,
>          bsf_ctx = bsf_ctx->next;
>      }
>  
> -    if (ret < 0) {
> -        av_log(log_ctx, AV_LOG_ERROR,
> -               "Failed to filter bitstream with filter %s for stream %d in file '%s' with codec %s\n",
> -               bsf_ctx->filter->name, pkt->stream_index, fmt_ctx->filename,
> -               avcodec_get_name(enc_ctx->codec_id));
> -    }
> -
>      return ret;
>  }

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131216/0068344f/attachment.asc>


More information about the ffmpeg-devel mailing list