diff mbox

[FFmpeg-devel,V1,1/3] lavf/mpegtsenc: fix logic check error

Message ID 1560618818-14485-1-git-send-email-mypopydev@gmail.com
State Accepted
Commit 8f7a043609554fd5e6917afeaed5d95bca420859
Headers show

Commit Message

Jun Zhao June 15, 2019, 5:13 p.m. UTC
From: Jun Zhao <barryjzhao@tencent.com>

fix the logic check error

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
---
 libavformat/mpegtsenc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Andriy Gelman Nov. 3, 2019, 7:24 p.m. UTC | #1
On Sun, 16. Jun 01:13, Jun Zhao wrote:
> From: Jun Zhao <barryjzhao@tencent.com>
> 
> fix the logic check error
> 
> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> ---
>  libavformat/mpegtsenc.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index fc0ea22..5d679c9 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -1651,7 +1651,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
>          } while (p < buf_end && (state & 0x7e) != 2*35 &&
>                   (state & 0x7e) >= 2*32);
>  
> -        if ((state & 0x7e) < 2*16 && (state & 0x7e) >= 2*24)
> +        if ((state & 0x7e) < 2*16 || (state & 0x7e) >= 2*24)
>              extradd = 0;
>          if ((state & 0x7e) != 2*35) { // AUD NAL
>              data = av_malloc(pkt->size + 7 + extradd);
> -- 
> 1.7.1
> 

Mentioned in #6751
Jun Zhao Nov. 4, 2019, 1:53 a.m. UTC | #2
On Mon, Nov 4, 2019 at 3:24 AM Andriy Gelman <andriy.gelman@gmail.com>
wrote:

> On Sun, 16. Jun 01:13, Jun Zhao wrote:
> > From: Jun Zhao <barryjzhao@tencent.com>
> >
> > fix the logic check error
> >
> > Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> > ---
> >  libavformat/mpegtsenc.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> > index fc0ea22..5d679c9 100644
> > --- a/libavformat/mpegtsenc.c
> > +++ b/libavformat/mpegtsenc.c
> > @@ -1651,7 +1651,7 @@ static int
> mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
> >          } while (p < buf_end && (state & 0x7e) != 2*35 &&
> >                   (state & 0x7e) >= 2*32);
> >
> > -        if ((state & 0x7e) < 2*16 && (state & 0x7e) >= 2*24)
> > +        if ((state & 0x7e) < 2*16 || (state & 0x7e) >= 2*24)
> >              extradd = 0;
> >          if ((state & 0x7e) != 2*35) { // AUD NAL
> >              data = av_malloc(pkt->size + 7 + extradd);
> > --
> > 1.7.1
> >
>
> Mentioned in #6751
>
> Will mention the ticket if apply, Thx
diff mbox

Patch

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index fc0ea22..5d679c9 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1651,7 +1651,7 @@  static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
         } while (p < buf_end && (state & 0x7e) != 2*35 &&
                  (state & 0x7e) >= 2*32);
 
-        if ((state & 0x7e) < 2*16 && (state & 0x7e) >= 2*24)
+        if ((state & 0x7e) < 2*16 || (state & 0x7e) >= 2*24)
             extradd = 0;
         if ((state & 0x7e) != 2*35) { // AUD NAL
             data = av_malloc(pkt->size + 7 + extradd);