[MPlayer-cvslog] r37878 - trunk/libmpdemux/demux_gif.c

reimar subversion at mplayerhq.hu
Thu Jul 21 23:46:43 CEST 2016


Author: reimar
Date: Thu Jul 21 23:46:42 2016
New Revision: 37878

Log:
demux_gif: use calloc, set biSize correctly.

Should fix trac issue 2301.

Modified:
   trunk/libmpdemux/demux_gif.c

Modified: trunk/libmpdemux/demux_gif.c
==============================================================================
--- trunk/libmpdemux/demux_gif.c	Fri Jul  8 10:23:56 2016	(r37877)
+++ trunk/libmpdemux/demux_gif.c	Thu Jul 21 23:46:42 2016	(r37878)
@@ -277,8 +277,9 @@ static int demux_gif_fill_buffer(demuxer
 
 static demuxer_t* demux_open_gif(demuxer_t* demuxer)
 {
-  gif_priv_t *priv = calloc(1, sizeof(gif_priv_t));
+  gif_priv_t *priv = calloc(1, sizeof(*priv));
   sh_video_t *sh_video = NULL;
+  int bih_size = sizeof(*sh_video->bih) + (256 * 4);
   GifFileType *gif = NULL;
 
   priv->current_pts = 0;
@@ -328,7 +329,8 @@ static demuxer_t* demux_open_gif(demuxer
   sh_video->fps = 5.0f;
   sh_video->frametime = 1.0f / sh_video->fps;
 
-  sh_video->bih = malloc(sizeof(*sh_video->bih) + (256 * 4));
+  sh_video->bih = calloc(1, bih_size);
+  sh_video->bih->biSize = bih_size;
   sh_video->bih->biCompression = sh_video->format;
   sh_video->bih->biWidth = priv->w = (uint16_t)gif->SWidth;
   sh_video->bih->biHeight = priv->h = (uint16_t)gif->SHeight;


More information about the MPlayer-cvslog mailing list