* qatar/master: avconv: flush filtered frames before reconfiguring filters mov: stsd entries must be at least 16 byte mov: detect EOF in mov_read_dref() file: return proper error on seek failures Conflicts: libavformat/file.c libavformat/mov.c Merged-by: Michael Niedermayer <michaelni@gmx.at>tags/n1.0
@@ -135,12 +135,17 @@ static int file_open(URLContext *h, const char *filename, int flags) | |||||
static int64_t file_seek(URLContext *h, int64_t pos, int whence) | static int64_t file_seek(URLContext *h, int64_t pos, int whence) | ||||
{ | { | ||||
FileContext *c = h->priv_data; | FileContext *c = h->priv_data; | ||||
int ret; | |||||
if (whence == AVSEEK_SIZE) { | if (whence == AVSEEK_SIZE) { | ||||
struct stat st; | struct stat st; | ||||
int ret = fstat(c->fd, &st); | |||||
ret = fstat(c->fd, &st); | |||||
return ret < 0 ? AVERROR(errno) : (S_ISFIFO(st.st_mode) ? 0 : st.st_size); | return ret < 0 ? AVERROR(errno) : (S_ISFIFO(st.st_mode) ? 0 : st.st_size); | ||||
} | } | ||||
return lseek(c->fd, pos, whence); | |||||
ret = lseek(c->fd, pos, whence); | |||||
return ret < 0 ? AVERROR(errno) : ret; | |||||
} | } | ||||
static int file_close(URLContext *h) | static int file_close(URLContext *h) | ||||
@@ -1204,16 +1204,16 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) | |||||
int dref_id = 1; | int dref_id = 1; | ||||
MOVAtom a = { AV_RL32("stsd") }; | MOVAtom a = { AV_RL32("stsd") }; | ||||
int64_t start_pos = avio_tell(pb); | int64_t start_pos = avio_tell(pb); | ||||
int size = avio_rb32(pb); /* size */ | |||||
int64_t size = avio_rb32(pb); /* size */ | |||||
uint32_t format = avio_rl32(pb); /* data format */ | uint32_t format = avio_rl32(pb); /* data format */ | ||||
if (size >= 16) { | if (size >= 16) { | ||||
avio_rb32(pb); /* reserved */ | avio_rb32(pb); /* reserved */ | ||||
avio_rb16(pb); /* reserved */ | avio_rb16(pb); /* reserved */ | ||||
dref_id = avio_rb16(pb); | dref_id = avio_rb16(pb); | ||||
}else if (size <= 0){ | |||||
}else if (size <= 7){ | |||||
av_log(c->fc, AV_LOG_ERROR, "invalid size %d in stsd\n", size); | av_log(c->fc, AV_LOG_ERROR, "invalid size %d in stsd\n", size); | ||||
return -1; | |||||
return AVERROR_INVALIDDATA; | |||||
} | } | ||||
if (st->codec->codec_tag && | if (st->codec->codec_tag && | ||||