Based on the check done for the stco box.
Showing the changes to libavformat (1 of 1 file). Show all
Unified · Split
| @@ -3145,6 +3145,11 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 3144 unmodified lines | ||
| 3145 | 3145 | MOVStreamContext *sc; |
| 3146 | 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 | 3153 | if (c->fc->nb_streams < 1) |
| 3149 | 3154 | return 0; |
| 3150 | 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 | 3246 | MOVStreamContext *sc; |
| 3242 | 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 | 3254 | if (c->fc->nb_streams < 1) |
| 3245 | 3255 | return 0; |
| 3246 | 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 | 3288 | MOVStreamContext *sc; |
| 3279 | 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 | 3296 | if (c->fc->nb_streams < 1) |
| 3282 | 3297 | return 0; |
| 3283 | 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 | 3345 | unsigned char* buf; |
| 3331 | 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 | 3353 | if (c->fc->nb_streams < 1) |
| 3334 | 3354 | return 0; |
| 3335 | 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 | 3439 | int64_t current_dts = 0; |
| 3420 | 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 | 3447 | if (c->fc->nb_streams < 1) |
| 3423 | 3448 | return 0; |
| 3424 | 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 | 3600 | MOVStreamContext *sc; |
| 3576 | 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 | 3608 | if (c->fc->nb_streams < 1) |
| 3579 | 3609 | return 0; |
| 3580 | 3610 | st = c->fc->streams[c->fc->nb_streams-1]; |