diff mbox series

[FFmpeg-devel,3/3] avformat/fifo: check for flushed packets and timeshift

Message ID 20210516193901.30853-3-michael@niedermayer.cc
State Accepted
Commit 3e44bd068fc19baeaab3295fce8379c68e4b2b2a
Headers show
Series [FFmpeg-devel,1/3] avcodec/dpx: fix off by 1 in bits_per_color check | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer May 16, 2021, 7:39 p.m. UTC
Fixes: CID1464151 Dereference after null check

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/fifo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marton Balint May 16, 2021, 8:37 p.m. UTC | #1
On Sun, 16 May 2021, Michael Niedermayer wrote:

> Fixes: CID1464151 Dereference after null check
>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
> libavformat/fifo.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/fifo.c b/libavformat/fifo.c
> index 620fffa032..50656f78b7 100644
> --- a/libavformat/fifo.c
> +++ b/libavformat/fifo.c
> @@ -593,7 +593,7 @@ static int fifo_write_packet(AVFormatContext *avf, AVPacket *pkt)
>         goto fail;
>     }
>
> -    if (fifo->timeshift && pkt->dts != AV_NOPTS_VALUE)
> +    if (fifo->timeshift && pkt && pkt->dts != AV_NOPTS_VALUE)
>         atomic_fetch_add_explicit(&fifo->queue_duration, next_duration(avf, pkt, &fifo->last_sent_dts), memory_order_relaxed);
>
>     return ret;

LGTM, thanks.

Marton
Michael Niedermayer May 18, 2021, 5:11 p.m. UTC | #2
On Sun, May 16, 2021 at 10:37:26PM +0200, Marton Balint wrote:
> 
> 
> On Sun, 16 May 2021, Michael Niedermayer wrote:
> 
> > Fixes: CID1464151 Dereference after null check
> > 
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> > libavformat/fifo.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavformat/fifo.c b/libavformat/fifo.c
> > index 620fffa032..50656f78b7 100644
> > --- a/libavformat/fifo.c
> > +++ b/libavformat/fifo.c
> > @@ -593,7 +593,7 @@ static int fifo_write_packet(AVFormatContext *avf, AVPacket *pkt)
> >         goto fail;
> >     }
> > 
> > -    if (fifo->timeshift && pkt->dts != AV_NOPTS_VALUE)
> > +    if (fifo->timeshift && pkt && pkt->dts != AV_NOPTS_VALUE)
> >         atomic_fetch_add_explicit(&fifo->queue_duration, next_duration(avf, pkt, &fifo->last_sent_dts), memory_order_relaxed);
> > 
> >     return ret;
> 
> LGTM, thanks.

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavformat/fifo.c b/libavformat/fifo.c
index 620fffa032..50656f78b7 100644
--- a/libavformat/fifo.c
+++ b/libavformat/fifo.c
@@ -593,7 +593,7 @@  static int fifo_write_packet(AVFormatContext *avf, AVPacket *pkt)
         goto fail;
     }
 
-    if (fifo->timeshift && pkt->dts != AV_NOPTS_VALUE)
+    if (fifo->timeshift && pkt && pkt->dts != AV_NOPTS_VALUE)
         atomic_fetch_add_explicit(&fifo->queue_duration, next_duration(avf, pkt, &fifo->last_sent_dts), memory_order_relaxed);
 
     return ret;