[FFmpeg-devel] [PATCH] Fix warnings in decode_dvd_subtitles (in libavcodec/dvdsubdec.c)

Eli Friedman eli.friedman
Wed Jul 7 05:26:14 CEST 2010


Attached.  Fixes warnings of the form "'colormap[3]' may be used
uninitialized in this function".  In this particular case, gcc is
correct: there will be uninitialized reads for any stream without a
"set colormap" command.  Therefore, this patch adds an initializer for
it.

-Eli
-------------- next part --------------
Index: libavcodec/dvdsubdec.c
===================================================================
--- libavcodec/dvdsubdec.c	(revision 24068)
+++ libavcodec/dvdsubdec.c	(working copy)
@@ -166,7 +166,8 @@
     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};
+    uint8_t alpha[256];
     int date;
     int i;
     int is_menu = 0;



More information about the ffmpeg-devel mailing list