aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-11-04 03:59:08 +0000
committerPaul B Mahol <onemda@gmail.com>2012-11-04 03:59:08 +0000
commit1c5b56eec7bb6c8554d33f50adae4359d243e390 (patch)
treeab2201d352bd9295710d21248ffdb82d7deb4811
parent4a2599b0e6b8a7076c9141d863d49667b089a45c (diff)
downloadffmpeg-1c5b56eec7bb6c8554d33f50adae4359d243e390.tar.gz
vocenc: abort if unsupported codec is used
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r--libavformat/vocenc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/vocenc.c b/libavformat/vocenc.c
index d97cdc4c15..27ed16f7fa 100644
--- a/libavformat/vocenc.c
+++ b/libavformat/vocenc.c
@@ -30,6 +30,7 @@ typedef struct voc_enc_context {
static int voc_write_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
+ AVCodecContext *enc = s->streams[0]->codec;
const int header_size = 26;
const int version = 0x0114;
@@ -37,6 +38,11 @@ static int voc_write_header(AVFormatContext *s)
|| s->streams[0]->codec->codec_type != AVMEDIA_TYPE_AUDIO)
return AVERROR_PATCHWELCOME;
+ if (!enc->codec_tag || enc->codec_tag > 0xffff) {
+ av_log(s, AV_LOG_ERROR, "unsupported codec\n");
+ return AVERROR(EINVAL);
+ }
+
avio_write(pb, ff_voc_magic, sizeof(ff_voc_magic) - 1);
avio_wl16(pb, header_size);
avio_wl16(pb, version);