diff mbox series

[FFmpeg-devel,1/2] avcodec/movtextenc: Fix potential use of unitialized value

Message ID 20201015140052.100725-1-andreas.rheinhardt@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,1/2] avcodec/movtextenc: Fix potential use of unitialized value | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Oct. 15, 2020, 2 p.m. UTC
Background colour was never initialized if no style was available.
Use a sane default of zero (i.e. completely transparent).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/movtextenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Moritz Barsnick Oct. 15, 2020, 9:01 p.m. UTC | #1
On Thu, Oct 15, 2020 at 16:00:50 +0200, Andreas Rheinhardt wrote:

Nit:
> Subject: avcodec/movtextenc: Fix potential use of unitialized value
uninitialized

Moritz
Andreas Rheinhardt Oct. 15, 2020, 11:04 p.m. UTC | #2
Moritz Barsnick:
> On Thu, Oct 15, 2020 at 16:00:50 +0200, Andreas Rheinhardt wrote:
> 
> Nit:
>> Subject: avcodec/movtextenc: Fix potential use of unitialized value
> uninitialized
> 
Thanks, fixed locally. Also added a reference to Coverity ticket
#1461471 (which this commit fixes).

- Andreas
diff mbox series

Patch

diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c
index b2368b641b..00ebca2e56 100644
--- a/libavcodec/movtextenc.c
+++ b/libavcodec/movtextenc.c
@@ -202,7 +202,7 @@  static int encode_sample_description(AVCodecContext *avctx)
     ASS * ass;
     ASSStyle * style;
     int i, j;
-    uint32_t tsmb_size, tsmb_type, back_color, style_color;
+    uint32_t tsmb_size, tsmb_type, back_color = 0, style_color;
     uint16_t style_start, style_end, fontID, count;
     int font_names_total_len = 0;
     MovTextContext *s = avctx->priv_data;