Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2014-09-01 16:04:54 +0400
committerStefano Sabatini <stefasab@gmail.com>2014-09-05 13:20:07 +0400
commit6f0fc1a96bd436a619de4c9ed33dec8db6d97c52 (patch)
tree0f8aa6c90cd853af11f291b7df3a286c4165cba8 /libavformat/ffmdec.c
parent39b517fac0b6d1412b94f30d7be4ec1de65e473a (diff)
lavf/ffmdec: return proper error code in ffm2_read_header()
Also log an error message in case of invalid packet size.
Diffstat (limited to 'libavformat/ffmdec.c')
-rw-r--r--libavformat/ffmdec.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index f8fee2f35f..448762b026 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -236,10 +236,16 @@ static int ffm2_read_header(AVFormatContext *s)
AVStream *st;
AVIOContext *pb = s->pb;
AVCodecContext *codec;
+ int ret;
ffm->packet_size = avio_rb32(pb);
- if (ffm->packet_size != FFM_PACKET_SIZE)
+ if (ffm->packet_size != FFM_PACKET_SIZE) {
+ av_log(s, AV_LOG_ERROR, "Invalid packet size %d, expected size was %d\n",
+ ffm->packet_size, FFM_PACKET_SIZE);
+ ret = AVERROR_INVALIDDATA;
goto fail;
+ }
+
ffm->write_index = avio_rb64(pb);
/* get also filesize */
if (pb->seekable) {
@@ -266,8 +272,10 @@ static int ffm2_read_header(AVFormatContext *s)
break;
case MKBETAG('C', 'O', 'M', 'M'):
st = avformat_new_stream(s, NULL);
- if (!st)
+ if (!st) {
+ ret = AVERROR(ENOMEM);
goto fail;
+ }
avpriv_set_pts_info(st, 64, 1, 1000000);
@@ -359,7 +367,7 @@ static int ffm2_read_header(AVFormatContext *s)
return 0;
fail:
ffm_close(s);
- return -1;
+ return ret;
}
static int ffm_read_header(AVFormatContext *s)