[FFmpeg-devel] Segfault calling av_interleaved_write_frame

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Sat Jan 18 23:45:36 EET 2020


On Sat, Jan 18, 2020 at 10:40 PM Jonathan Noble <jonnobleuk at gmail.com>
wrote:

> Hello,
>
> I found I was getting sigsegv when calling av_interleaved_write_frame().
>
> From a18f4cb5b86392c5c161878daea8e4b1204881eb Mon Sep 17 00:00:00 2001
> From: jon noble <jonnobleuk at gmail.com>
> Date: Sat, 18 Jan 2020 21:33:11 +0000
> Subject: [PATCH] libavformat/mux: prevent segfault in
>  compute_muxer_pkt_fields()
>
> ---
>  libavformat/mux.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/libavformat/mux.c b/libavformat/mux.c
> index 8ab5ea8c2b..ea79981fe8 100644
> --- a/libavformat/mux.c
> +++ b/libavformat/mux.c
> @@ -598,9 +598,11 @@ static int compute_muxer_pkt_fields(AVFormatContext
> *s, AVStream *st, AVPacket *
>              av_log(s, AV_LOG_WARNING, "Encoder did not produce proper pts,
> making some up.\n");
>              warned = 1;
>          }
> -        pkt->dts =
> -//        pkt->pts= st->cur_dts;
> -            pkt->pts = st->internal->priv_pts->val;
> +        if (st->internal->priv_pts == NULL) {
> +          av_log(s, AV_LOG_WARNING, "Null private stream data.\n");
> +          return AVERROR(EINVAL);
> +        }
> +        pkt->dts = pkt->pts = st->internal->priv_pts->val;
>      }
>
>      //calculate dts from pts
> --
> 2.25.0
>
> Can you give us the command line together with the necessary sample files
that allow to reproduce this segfault?

- Andreas


More information about the ffmpeg-devel mailing list