1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-03-17 20:17:55 +02:00

avformat/swfenc: Fix integer overflow in frame rate handling

Fixes: signed integer overflow: 30000299 * 256 cannot be represented in type 'int'
Fixes: ticket8184

Found-by: Suhwan
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 31f956acadd994b8c4e22b714aaffee0f527c827)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2020-02-16 18:32:31 +01:00
parent 42d2468ce4
commit 4dd9ae41a2

View File

@ -256,7 +256,7 @@ static int swf_write_header(AVFormatContext *s)
av_log(s, AV_LOG_ERROR, "Invalid (too large) frame rate %d/%d\n", rate, rate_base);
return AVERROR(EINVAL);
}
avio_wl16(pb, (rate * 256) / rate_base); /* frame rate */
avio_wl16(pb, (rate * 256LL) / rate_base); /* frame rate */
swf->duration_pos = avio_tell(pb);
avio_wl16(pb, (uint16_t)(DUMMY_DURATION * (int64_t)rate / rate_base)); /* frame count */