Re: [FFmpeg-devel] [PATCH 1/8] ffmdec: initialize f_cprv, f_stvi and f_stau
On 09.03.2015 13:20, Lukasz Marek wrote: BTW, did you produced this malformed file using ffmpeg tools or just prevent theoretical case? I fuzzed a file created by ffmpeg. Best regards, Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/8] ffmdec: initialize f_cprv, f_stvi and f_stau
On 9 March 2015 at 12:41, Andreas Cadhalpun andreas.cadhal...@googlemail.com wrote: On 09.03.2015 10:53, Lukasz Marek wrote: In fact this is a bit wrong. COMM is guaranteed unless malformed file is parsed. These variables are dedicated to detect doubled sections. This patch allows them to occur twice in that case. So they should be initialized to 0. This patch doesn't change anything for valid files, it only prevents crashes with malformed files. For valid files, these variables are initialized to -1, then set to 0 in the COMM part of the switch. For invalid files, if another section comes before COMM, the counter is -1, thus e.g. 'if (f_stvi++)' is true and AVERROR(EINVAL) is returned. If they were initialized to 0, the check wouldn't trigger for malformed files, leading to crashes, because codec is not set. OK. BTW, did you produced this malformed file using ffmpeg tools or just prevent theoretical case? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/8] ffmdec: initialize f_cprv, f_stvi and f_stau
On 09.03.2015 02:45, Michael Niedermayer wrote: On Mon, Mar 09, 2015 at 12:02:55AM +0100, Andreas Cadhalpun wrote: Hi, attached patch fixes 'Conditional jump or move depends on uninitialized variables' valgrind warnings. Best regards, Andreas ffmdec.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 4a297cdd7cdb822a449cd846139a86ae284893aa 0001-ffmdec-initialize-f_cprv-f_stvi-and-f_stau.patch From 8b1088fa1509b1613d095fbe1c11eec6d251c95c Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun andreas.cadhal...@googlemail.com Date: Sun, 8 Mar 2015 22:52:47 +0100 Subject: [PATCH 1/8] ffmdec: initialize f_cprv, f_stvi and f_stau They are used in a switch statement, but it is not guaranteed that the COMM case (where they are set to 0) is reached before the other cases. applied thanks In fact this is a bit wrong. COMM is guaranteed unless malformed file is parsed. These variables are dedicated to detect doubled sections. This patch allows them to occur twice in that case. So they should be initialized to 0. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/8] ffmdec: initialize f_cprv, f_stvi and f_stau
On Mon, Mar 09, 2015 at 12:02:55AM +0100, Andreas Cadhalpun wrote: Hi, attached patch fixes 'Conditional jump or move depends on uninitialized variables' valgrind warnings. Best regards, Andreas ffmdec.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 4a297cdd7cdb822a449cd846139a86ae284893aa 0001-ffmdec-initialize-f_cprv-f_stvi-and-f_stau.patch From 8b1088fa1509b1613d095fbe1c11eec6d251c95c Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun andreas.cadhal...@googlemail.com Date: Sun, 8 Mar 2015 22:52:47 +0100 Subject: [PATCH 1/8] ffmdec: initialize f_cprv, f_stvi and f_stau They are used in a switch statement, but it is not guaranteed that the COMM case (where they are set to 0) is reached before the other cases. applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/8] ffmdec: initialize f_cprv, f_stvi and f_stau
Hi, attached patch fixes 'Conditional jump or move depends on uninitialized variables' valgrind warnings. Best regards, Andreas From 8b1088fa1509b1613d095fbe1c11eec6d251c95c Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun andreas.cadhal...@googlemail.com Date: Sun, 8 Mar 2015 22:52:47 +0100 Subject: [PATCH 1/8] ffmdec: initialize f_cprv, f_stvi and f_stau They are used in a switch statement, but it is not guaranteed that the COMM case (where they are set to 0) is reached before the other cases. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com --- libavformat/ffmdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 987f419..280a24c 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -261,7 +261,7 @@ static int ffm2_read_header(AVFormatContext *s) AVIOContext *pb = s-pb; AVCodecContext *codec; int ret; -int f_main = 0, f_cprv, f_stvi, f_stau; +int f_main = 0, f_cprv = -1, f_stvi = -1, f_stau = -1; AVCodec *enc; char *buffer; -- 2.1.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel