smacker: fix integer overflow with pts_inc

Bug-Id: 1073

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Sean McGovern <gseanmcg@gmail.com>
This commit is contained in:
Michael Niedermayer 2017-09-24 12:58:42 +02:00 committed by Sean McGovern
parent 9e36102278
commit ec683ed527
1 changed files with 5 additions and 0 deletions

View File

@ -117,6 +117,11 @@ static int smacker_read_header(AVFormatContext *s)
smk->height = avio_rl32(pb); smk->height = avio_rl32(pb);
smk->frames = avio_rl32(pb); smk->frames = avio_rl32(pb);
smk->pts_inc = (int32_t)avio_rl32(pb); smk->pts_inc = (int32_t)avio_rl32(pb);
if (smk->pts_inc > INT_MAX / 100) {
av_log(s, AV_LOG_ERROR, "pts_inc %d is too large\n", smk->pts_inc);
return AVERROR_INVALIDDATA;
}
smk->flags = avio_rl32(pb); smk->flags = avio_rl32(pb);
if(smk->flags & SMACKER_FLAG_RING_FRAME) if(smk->flags & SMACKER_FLAG_RING_FRAME)
smk->frames++; smk->frames++;