History

avformat/mov: check that child boxes of trak are only present inside it

Based on the check done for the stco box.

James Almer committed 2 years ago

Commit e7d3ff81 parent 2aa63781 file · +30 −0Browse files

Unified · Split

libavformat/mov.c+30−0
@@ -3145,6 +3145,11 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 3144 unmodified lines
3145 MOVStreamContext *sc;3145 MOVStreamContext *sc;
3146 unsigned int i, entries;3146 unsigned int i, entries;
3147 3147
3148 if (c->trak_index < 0) {
3149 av_log(c->fc, AV_LOG_WARNING, "STSC outside TRAK\n");
3150 return 0;
3151 }
3152
3148 if (c->fc->nb_streams < 1)3153 if (c->fc->nb_streams < 1)
3149 return 0;3154 return 0;
3150 st = c->fc->streams[c->fc->nb_streams-1];3155 st = c->fc->streams[c->fc->nb_streams-1];
@@ -3241,6 +3246,11 @@ static int mov_read_stps(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 90 unmodified lines
3241 MOVStreamContext *sc;3246 MOVStreamContext *sc;
3242 unsigned i, entries;3247 unsigned i, entries;
3243 3248
3249 if (c->trak_index < 0) {
3250 av_log(c->fc, AV_LOG_WARNING, "STPS outside TRAK\n");
3251 return 0;
3252 }
3253
3244 if (c->fc->nb_streams < 1)3254 if (c->fc->nb_streams < 1)
3245 return 0;3255 return 0;
3246 st = c->fc->streams[c->fc->nb_streams-1];3256 st = c->fc->streams[c->fc->nb_streams-1];
@@ -3278,6 +3288,11 @@ static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 31 unmodified lines
3278 MOVStreamContext *sc;3288 MOVStreamContext *sc;
3279 unsigned int i, entries;3289 unsigned int i, entries;
3280 3290
3291 if (c->trak_index < 0) {
3292 av_log(c->fc, AV_LOG_WARNING, "STSS outside TRAK\n");
3293 return 0;
3294 }
3295
3281 if (c->fc->nb_streams < 1)3296 if (c->fc->nb_streams < 1)
3282 return 0;3297 return 0;
3283 st = c->fc->streams[c->fc->nb_streams-1];3298 st = c->fc->streams[c->fc->nb_streams-1];
@@ -3330,6 +3345,11 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 46 unmodified lines
3330 unsigned char* buf;3345 unsigned char* buf;
3331 int ret;3346 int ret;
3332 3347
3348 if (c->trak_index < 0) {
3349 av_log(c->fc, AV_LOG_WARNING, "STSZ outside TRAK\n");
3350 return 0;
3351 }
3352
3333 if (c->fc->nb_streams < 1)3353 if (c->fc->nb_streams < 1)
3334 return 0;3354 return 0;
3335 st = c->fc->streams[c->fc->nb_streams-1];3355 st = c->fc->streams[c->fc->nb_streams-1];
@@ -3419,6 +3439,11 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 83 unmodified lines
3419 int64_t current_dts = 0;3439 int64_t current_dts = 0;
3420 int64_t corrected_dts = 0;3440 int64_t corrected_dts = 0;
3421 3441
3442 if (c->trak_index < 0) {
3443 av_log(c->fc, AV_LOG_WARNING, "STTS outside TRAK\n");
3444 return 0;
3445 }
3446
3422 if (c->fc->nb_streams < 1)3447 if (c->fc->nb_streams < 1)
3423 return 0;3448 return 0;
3424 st = c->fc->streams[c->fc->nb_streams-1];3449 st = c->fc->streams[c->fc->nb_streams-1];
@@ -3575,6 +3600,11 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 150 unmodified lines
3575 MOVStreamContext *sc;3600 MOVStreamContext *sc;
3576 unsigned int i, entries, ctts_count = 0;3601 unsigned int i, entries, ctts_count = 0;
3577 3602
3603 if (c->trak_index < 0) {
3604 av_log(c->fc, AV_LOG_WARNING, "CTTS outside TRAK\n");
3605 return 0;
3606 }
3607
3578 if (c->fc->nb_streams < 1)3608 if (c->fc->nb_streams < 1)
3579 return 0;3609 return 0;
3580 st = c->fc->streams[c->fc->nb_streams-1];3610 st = c->fc->streams[c->fc->nb_streams-1];

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t