[vlc-commits] Avcodec: Fix potential dereference before null check

Jean-Baptiste Kempf git at videolan.org
Fri Jun 20 16:11:38 CEST 2014


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Jun 20 16:09:41 2014 +0200| [e90491c351745313e333d219f8412ebed443c21a] | committer: Jean-Baptiste Kempf

Avcodec: Fix potential dereference before null check

See CID #1223114

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e90491c351745313e333d219f8412ebed443c21a
---

 modules/codec/avcodec/video.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 65c6773..4c09175 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -855,12 +855,11 @@ static void ffmpeg_CopyPicture( decoder_t *p_dec,
         if( p_sys->p_context->pix_fmt == PIX_FMT_PAL8 )
         {
             if( !p_pic->format.p_palette )
-            {
                 p_pic->format.p_palette = calloc( 1, sizeof(video_palette_t) );
-                p_pic->format.p_palette->i_entries = 256;
-            }
+
             if( p_pic->format.p_palette )
             {
+                p_pic->format.p_palette->i_entries = AVPALETTE_COUNT;
                 memcpy( p_pic->format.p_palette->palette, p_ff_pic->data[1], AVPALETTE_SIZE );
             }
         }



More information about the vlc-commits mailing list