summaryrefslogtreecommitdiff
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-07-15 17:13:54 +0300
committerMartin Storsjö <martin@martin.st>2013-07-15 21:38:58 +0300
commit31931520df35a6f9606fe8293c8a39e2d1fabedf (patch)
tree96f5f3b6abd13ea57bd3da1c53f5040710ff68a0 /libavformat/mov.c
parent5b4eb243bce10a3e8345401a353749e0414c54ca (diff)
mov: Do not allow updating the time scale after it has been set
The time scale is set in mdhd, and later validated in the enclosing trak atom once all of its children have been parsed. A loose mdhd atom outside of a trak atom could update the time scale of the last stream without any validation. Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Cc: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index b33b30db34..0c938cd2dd 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -713,6 +713,11 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
+ if (sc->time_scale) {
+ av_log(c->fc, AV_LOG_ERROR, "Multiple mdhd?\n");
+ return AVERROR_INVALIDDATA;
+ }
+
version = avio_r8(pb);
if (version > 1) {
avpriv_request_sample(c->fc, "Version %d", version);