Browse code

avformat/movenc: Check that track_width_1616 fits within the available 32bit before storing it

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2015/05/29 19:54:37
Showing 1 changed files
... ...
@@ -2371,7 +2371,9 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov,
2371 2371
             int64_t track_width_1616 = av_rescale(st->sample_aspect_ratio.num,
2372 2372
                                                   track->enc->width * 0x10000LL,
2373 2373
                                                   st->sample_aspect_ratio.den);
2374
-            if (!track_width_1616 || track->height != track->enc->height)
2374
+            if (!track_width_1616 ||
2375
+                track->height != track->enc->height ||
2376
+                track_width_1616 > UINT32_MAX)
2375 2377
                 track_width_1616 = track->enc->width * 0x10000;
2376 2378
             avio_wb32(pb, track_width_1616);
2377 2379
             avio_wb32(pb, track->height * 0x10000);