diff mbox

[FFmpeg-devel,2/2] mpegtsenc: Don't pass NULL to memcpy

Message ID 20170706173421.1257-3-derek.buitenhuis@gmail.com
State Superseded
Headers show

Commit Message

Derek Buitenhuis July 6, 2017, 5:34 p.m. UTC
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
---
 libavformat/mpegtsenc.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Michael Niedermayer July 6, 2017, 10:13 p.m. UTC | #1
On Thu, Jul 06, 2017 at 06:34:21PM +0100, Derek Buitenhuis wrote:
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
> ---
>  libavformat/mpegtsenc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index acea2e93a6..f62ed55dea 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -277,6 +277,8 @@ static void putstr8(uint8_t **q_ptr, const char *str, int write_len)
>          len = strlen(str);
>      if (write_len)
>          *q++ = len;
> +    if (!str)
> +        return;
>      memcpy(q, str, len);
>      q     += len;

>      *q_ptr = q;

this should not be skiped if str==NULL

otherwise LGTM

thx

[...]
Michael Niedermayer July 6, 2017, 10:15 p.m. UTC | #2
On Fri, Jul 07, 2017 at 12:13:02AM +0200, Michael Niedermayer wrote:
> On Thu, Jul 06, 2017 at 06:34:21PM +0100, Derek Buitenhuis wrote:
> > Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
> > ---
> >  libavformat/mpegtsenc.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> > index acea2e93a6..f62ed55dea 100644
> > --- a/libavformat/mpegtsenc.c
> > +++ b/libavformat/mpegtsenc.c
> > @@ -277,6 +277,8 @@ static void putstr8(uint8_t **q_ptr, const char *str, int write_len)
> >          len = strlen(str);
> >      if (write_len)
> >          *q++ = len;
> > +    if (!str)
> > +        return;
> >      memcpy(q, str, len);
> >      q     += len;
> 
> >      *q_ptr = q;
> 
> this should not be skiped if str==NULL

i just saw you already fixed this and posted a v2

thx

[...]
diff mbox

Patch

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index acea2e93a6..f62ed55dea 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -277,6 +277,8 @@  static void putstr8(uint8_t **q_ptr, const char *str, int write_len)
         len = strlen(str);
     if (write_len)
         *q++ = len;
+    if (!str)
+        return;
     memcpy(q, str, len);
     q     += len;
     *q_ptr = q;