Skip to content

Commit

Permalink
avcodec/cavsdec: Check sym_factor
Browse files Browse the repository at this point in the history
Fixes: runtime error: signed integer overflow: 25984 * 130560 cannot be represented in type 'int'

Fixes: 1404/clusterfuzz-testcase-minimized-5000441286885376

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
  • Loading branch information
michaelni committed May 8, 2017
1 parent 1e42736 commit 279420b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libavcodec/cavsdec.c
Expand Up @@ -1031,6 +1031,10 @@ static int decode_pic(AVSContext *h)
h->scale_den[1] = h->dist[1] ? 512/h->dist[1] : 0;
if (h->cur.f->pict_type == AV_PICTURE_TYPE_B) {
h->sym_factor = h->dist[0] * h->scale_den[1];
if (FFABS(h->sym_factor) > 32768) {
av_log(h->avctx, AV_LOG_ERROR, "sym_factor %d too large\n", h->sym_factor);
return AVERROR_INVALIDDATA;
}
} else {
h->direct_den[0] = h->dist[0] ? 16384 / h->dist[0] : 0;
h->direct_den[1] = h->dist[1] ? 16384 / h->dist[1] : 0;
Expand Down

0 comments on commit 279420b

Please sign in to comment.