lavf/cafenc: Only allow mono and stereo for Opus.
authorCarl Eugen Hoyos <ceffmpeg@gmail.com>
Tue, 17 Oct 2017 21:00:07 +0000 (23:00 +0200)
committerCarl Eugen Hoyos <ceffmpeg@gmail.com>
Tue, 17 Oct 2017 21:00:07 +0000 (23:00 +0200)
Found-by: James Almer
libavformat/cafenc.c

index 211b046563fc6ef1b4f6e7fdc92f139fb02c1886..0f7c4ebbb32c458946428147b84ab15d461cef3e 100644 (file)
@@ -123,6 +123,11 @@ static int caf_write_header(AVFormatContext *s)
         return AVERROR_PATCHWELCOME;
     }
 
+    if (par->codec_id == AV_CODEC_ID_OPUS && par->channels > 2) {
+        av_log(s, AV_LOG_ERROR, "Only mono and stereo are supported for Opus\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     if (!codec_tag) {
         av_log(s, AV_LOG_ERROR, "unsupported codec\n");
         return AVERROR_INVALIDDATA;