aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2017-02-15 10:40:16 -0500
committerVittorio Giovara <vittorio.giovara@gmail.com>2017-03-07 11:07:02 -0500
commit0f8512c4a87b89b4694053d8ffda48066ee1da62 (patch)
tree94b3b196ce22a4278c21c5002cd442d4aa149f7c /libavformat/mov.c
parent236577230051ad61ec67fa2d68e817d54232d2a0 (diff)
downloadffmpeg-0f8512c4a87b89b4694053d8ffda48066ee1da62.tar.gz
mov: Validate spherical metadata version
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index f1ff6ad5b5..f406831457 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3235,7 +3235,7 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
AVStream *st;
MOVStreamContext *sc;
- int size;
+ int size, version;
int32_t yaw, pitch, roll;
uint32_t tag;
enum AVSphericalProjection projection;
@@ -3260,7 +3260,13 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom)
av_log(c->fc, AV_LOG_ERROR, "Missing spherical video header\n");
return 0;
}
- avio_skip(pb, 4); /* version + flags */
+ version = avio_r8(pb);
+ if (version != 0) {
+ av_log(c->fc, AV_LOG_WARNING, "Unknown spherical version %d\n",
+ version);
+ return 0;
+ }
+ avio_skip(pb, 3); /* flags */
avio_skip(pb, size - 12); /* metadata_source */
size = avio_rb32(pb);
@@ -3282,7 +3288,13 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom)
av_log(c->fc, AV_LOG_ERROR, "Missing projection header box\n");
return 0;
}
- avio_skip(pb, 4); /* version + flags */
+ version = avio_r8(pb);
+ if (version != 0) {
+ av_log(c->fc, AV_LOG_WARNING, "Unknown spherical version %d\n",
+ version);
+ return 0;
+ }
+ avio_skip(pb, 3); /* flags */
/* 16.16 fixed point */
yaw = avio_rb32(pb);
@@ -3294,7 +3306,13 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return AVERROR_INVALIDDATA;
tag = avio_rl32(pb);
- avio_skip(pb, 4); /* version + flags */
+ version = avio_r8(pb);
+ if (version != 0) {
+ av_log(c->fc, AV_LOG_WARNING, "Unknown spherical version %d\n",
+ version);
+ return 0;
+ }
+ avio_skip(pb, 3); /* flags */
switch (tag) {
case MKTAG('c','b','m','p'):
projection = AV_SPHERICAL_CUBEMAP;