aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/wtvdec.c
diff options
context:
space:
mode:
authorPeter Ross <pross@xvid.org>2013-12-23 21:04:45 +1100
committerMichael Niedermayer <michaelni@gmx.at>2013-12-23 13:33:45 +0100
commitd08ea75a825a8091e995a8e0d7c415ccc4339ec9 (patch)
treecc8a35c90e512b43c5ca7f4b8bdd64c5dc7332bb /libavformat/wtvdec.c
parent5a1bfa7ed72dad746203d9f68fbe5773ddd9546e (diff)
downloadffmpeg-d08ea75a825a8091e995a8e0d7c415ccc4339ec9.tar.gz
wtvenc: test avio_size() validity
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/wtvdec.c')
-rw-r--r--libavformat/wtvdec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c
index 48f51ad913..ce767549a4 100644
--- a/libavformat/wtvdec.c
+++ b/libavformat/wtvdec.c
@@ -153,6 +153,7 @@ static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int
AVIOContext *pb;
WtvFile *wf;
uint8_t *buffer;
+ int64_t size;
if (seek_by_sector(s->pb, first_sector, 0) < 0)
return NULL;
@@ -205,7 +206,8 @@ static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int
return NULL;
}
- if ((int64_t)wf->sectors[wf->nb_sectors - 1] << WTV_SECTOR_BITS > avio_size(s->pb))
+ size = avio_size(s->pb);
+ if (size >= 0 && (int64_t)wf->sectors[wf->nb_sectors - 1] << WTV_SECTOR_BITS > size)
av_log(s, AV_LOG_WARNING, "truncated file\n");
/* check length */