[FFmpeg-cvslog] avcodec/amr_parser: Treat 0 channels as 1
Michael Niedermayer
git at videolan.org
Thu Oct 7 20:39:18 EEST 2021
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Oct 5 21:17:54 2021 +0200| [cc721fc29240fadd0aec5b86cf15b5ffb49f303e] | committer: Michael Niedermayer
avcodec/amr_parser: Treat 0 channels as 1
Fixes: division by 0
Fixes: 39562/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AMRWB_fuzzer-5448834960982016
Fixes: 39589/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AMRWB_fuzzer-6119205334810624
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cc721fc29240fadd0aec5b86cf15b5ffb49f303e
---
libavcodec/amr_parser.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libavcodec/amr_parser.c b/libavcodec/amr_parser.c
index 79258d4d0c..c0b14700e2 100644
--- a/libavcodec/amr_parser.c
+++ b/libavcodec/amr_parser.c
@@ -25,6 +25,7 @@
* Splits packets into individual blocks.
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "parser.h"
@@ -62,6 +63,11 @@ static int amr_parse(AVCodecParserContext *s1,
*poutbuf_size = 0;
*poutbuf = NULL;
+ if (!avctx->channels) {
+ avctx->channels = 1;
+ avctx->channel_layout = AV_CH_LAYOUT_MONO;
+ }
+
if (s1->flags & PARSER_FLAG_COMPLETE_FRAMES) {
next = buf_size;
} else {
More information about the ffmpeg-cvslog
mailing list