[FFmpeg-cvslog] mov.c: fix handling of seek return in read_mfra
Mika Raento
git at videolan.org
Sat Nov 15 12:12:44 CET 2014
ffmpeg | branch: master | Mika Raento <mikie at iki.fi> | Fri Nov 14 19:12:34 2014 +0200| [b08fd7ea78792c4e0141e2d384b9acd4699bb5cc] | committer: Michael Niedermayer
mov.c: fix handling of seek return in read_mfra
this would cause mfra to be ignored in files larger than 2G
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b08fd7ea78792c4e0141e2d384b9acd4699bb5cc
---
libavformat/mov.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 6ba7b96..8bf16e7 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3819,36 +3819,42 @@ static int mov_read_mfra(MOVContext *c, AVIOContext *f)
{
int64_t stream_size = avio_size(f);
int64_t original_pos = avio_tell(f);
+ int64_t seek_ret;
int32_t mfra_size;
int ret = -1;
- if ((ret = avio_seek(f, stream_size - 4, SEEK_SET)) < 0) goto fail;
+ if ((seek_ret = avio_seek(f, stream_size - 4, SEEK_SET)) < 0) {
+ ret = seek_ret;
+ goto fail;
+ }
mfra_size = avio_rb32(f);
if (mfra_size < 0 || mfra_size > stream_size) {
av_log(c->fc, AV_LOG_DEBUG, "doesn't look like mfra (unreasonable size)\n");
- ret = -1;
goto fail;
}
- if ((ret = avio_seek(f, -mfra_size, SEEK_CUR)) < 0) goto fail;
+ if ((seek_ret = avio_seek(f, -mfra_size, SEEK_CUR)) < 0) {
+ ret = seek_ret;
+ goto fail;
+ }
if (avio_rb32(f) != mfra_size) {
av_log(c->fc, AV_LOG_DEBUG, "doesn't look like mfra (size mismatch)\n");
- ret = -1;
goto fail;
}
if (avio_rb32(f) != MKBETAG('m', 'f', 'r', 'a')) {
av_log(c->fc, AV_LOG_DEBUG, "doesn't look like mfra (tag mismatch)\n");
goto fail;
}
+ ret = 0;
av_log(c->fc, AV_LOG_VERBOSE, "stream has mfra\n");
while (!read_tfra(c, f)) {
/* Empty */
}
fail:
- ret = avio_seek(f, original_pos, SEEK_SET);
- if (ret < 0)
+ seek_ret = avio_seek(f, original_pos, SEEK_SET);
+ if (seek_ret < 0) {
av_log(c->fc, AV_LOG_ERROR,
"failed to seek back after looking for mfra\n");
- else
- ret = 0;
+ ret = seek_ret;
+ }
return ret;
}
More information about the ffmpeg-cvslog
mailing list