[FFmpeg-devel] [PATCH] dvbsubdec: Avoid potential use of uninitialized memory
Clément Bœsch
ubitux at gmail.com
Mon Sep 12 21:32:32 CEST 2011
On Mon, Sep 12, 2011 at 09:13:47PM +0200, Joakim Plate wrote:
> Another option would be to move these variables to context
> and remember them between each call to decode_dvd_subtitles
> ---
> libavcodec/dvdsubdec.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
> diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
> index dcc5e6b..6325cce 100644
> --- a/libavcodec/dvdsubdec.c
> +++ b/libavcodec/dvdsubdec.c
> @@ -206,7 +206,7 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
> int cmd_pos, pos, cmd, x1, y1, x2, y2, offset1, offset2, next_cmd_pos;
> int big_offsets, offset_size, is_8bit = 0;
> const uint8_t *yuv_palette = 0;
> - uint8_t colormap[4], alpha[256];
> + uint8_t colormap[4] = {0}, alpha[256] = {0};
> int date;
> int i;
> int is_menu = 0;
Mmh it seems I forgot to apply that patch when I proposed it a while ago.
IIRC, only colormap is concerned about the uninitialized values. Also,
Michael pointed out the zeros might not be a good fallback values…
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110912/5da64f79/attachment.asc>
More information about the ffmpeg-devel
mailing list