diff mbox

[FFmpeg-devel] lavf/mpeg: Initialize a stack variable

Message ID 201702191618.16885.cehoyos@ag.or.at
State Accepted
Commit a5c1c7a8b3d13c86b453558628951c3f52054ab4
Headers show

Commit Message

Carl Eugen Hoyos Feb. 19, 2017, 3:18 p.m. UTC
Hi!

I cannot reproduce ticket #6160 and I wonder how memcmp() must be implemented 
to reproduce it but attached patch is supposed to fix it.

Please comment, Carl Eugen
From 0c3a72da0780682eb2899aee7ebe05a5e74a26eb Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos@ag.or.at>
Date: Sun, 19 Feb 2017 16:15:34 +0100
Subject: [PATCH] lavf/mpeg: Initialize a stack variable used by memcmp().

Fixes ticket #6160.
---
 libavformat/mpeg.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Feb. 21, 2017, 1:09 a.m. UTC | #1
On Sun, Feb 19, 2017 at 04:18:16PM +0100, Carl Eugen Hoyos wrote:
> Hi!
> 
> I cannot reproduce ticket #6160 and I wonder how memcmp() must be implemented 
> to reproduce it but attached patch is supposed to fix it.
> 
> Please comment, Carl Eugen

>  mpeg.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> c1f797e970fc296e35beb0b7701feb11e1d470f4  0001-lavf-mpeg-Initialize-a-stack-variable-used-by-memcmp.patch
> From 0c3a72da0780682eb2899aee7ebe05a5e74a26eb Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos <cehoyos@ag.or.at>
> Date: Sun, 19 Feb 2017 16:15:34 +0100
> Subject: [PATCH] lavf/mpeg: Initialize a stack variable used by memcmp().
> 
> Fixes ticket #6160.

LGTM

please also backport

thx

[...]
Carl Eugen Hoyos Feb. 21, 2017, 1:21 a.m. UTC | #2
2017-02-21 2:09 GMT+01:00 Michael Niedermayer <michael@niedermayer.cc>:
> On Sun, Feb 19, 2017 at 04:18:16PM +0100, Carl Eugen Hoyos wrote:
>> Hi!
>>
>> I cannot reproduce ticket #6160 and I wonder how memcmp() must be implemented
>> to reproduce it but attached patch is supposed to fix it.
>>
>> Please comment, Carl Eugen
>
>>  mpeg.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> c1f797e970fc296e35beb0b7701feb11e1d470f4  0001-lavf-mpeg-Initialize-a-stack-variable-used-by-memcmp.patch
>> From 0c3a72da0780682eb2899aee7ebe05a5e74a26eb Mon Sep 17 00:00:00 2001
>> From: Carl Eugen Hoyos <cehoyos@ag.or.at>
>> Date: Sun, 19 Feb 2017 16:15:34 +0100
>> Subject: [PATCH] lavf/mpeg: Initialize a stack variable used by memcmp().
>>
>> Fixes ticket #6160.
>
> LGTM

Pushed and backported.

Thank you, Carl Eugen
diff mbox

Patch

diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index 423877e..a651cb3 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -138,7 +138,7 @@  typedef struct MpegDemuxContext {
 static int mpegps_read_header(AVFormatContext *s)
 {
     MpegDemuxContext *m = s->priv_data;
-    char buffer[7];
+    char buffer[7] = { 0 };
     int64_t last_pos = avio_tell(s->pb);
 
     m->header_state = 0xff;