History

vocenc: abort if unsupported codec is used

Paul B Mahol committed 14 years ago

Commit 1c5b56e1 parent 4a2599b1 file · +6 −0Browse files

Unified · Split

libavformat/vocenc.c+6−0
@@ -30,6 +30,7 @@ typedef struct voc_enc_context { · 29 unmodified lines
3030 static int voc_write_header(AVFormatContext *s)
3131 {
3232 AVIOContext *pb = s->pb;
33+ AVCodecContext *enc = s->streams[0]->codec;
3334 const int header_size = 26;
3435 const int version = 0x0114;
3536
@@ -37,6 +38,11 @@ static int voc_write_header(AVFormatContext *s) · 1 unmodified line
3738 || s->streams[0]->codec->codec_type != AVMEDIA_TYPE_AUDIO)
3839 return AVERROR_PATCHWELCOME;
3940
41+ if (!enc->codec_tag || enc->codec_tag > 0xffff) {
42+ av_log(s, AV_LOG_ERROR, "unsupported codec\n");
43+ return AVERROR(EINVAL);
44+ }
45+
4046 avio_write(pb, ff_voc_magic, sizeof(ff_voc_magic) - 1);
4147 avio_wl16(pb, header_size);
4248 avio_wl16(pb, version);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t