Commit db1a99a2 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/snowdec: Fix ref value check

Fixes integer overflow and out of array read.
Fixes: signal_sigsegv_24169e6_3445_cov_3778346427_snow_chroma_bug.avi

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8f4cbf94)
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent fe8c81a0
...@@ -152,7 +152,7 @@ static int decode_q_branch(SnowContext *s, int level, int x, int y){ ...@@ -152,7 +152,7 @@ static int decode_q_branch(SnowContext *s, int level, int x, int y){
int l = left->color[0]; int l = left->color[0];
int cb= left->color[1]; int cb= left->color[1];
int cr= left->color[2]; int cr= left->color[2];
int ref = 0; unsigned ref = 0;
int ref_context= av_log2(2*left->ref) + av_log2(2*top->ref); int ref_context= av_log2(2*left->ref) + av_log2(2*top->ref);
int mx_context= av_log2(2*FFABS(left->mx - top->mx)) + 0*av_log2(2*FFABS(tr->mx - top->mx)); int mx_context= av_log2(2*FFABS(left->mx - top->mx)) + 0*av_log2(2*FFABS(tr->mx - top->mx));
int my_context= av_log2(2*FFABS(left->my - top->my)) + 0*av_log2(2*FFABS(tr->my - top->my)); int my_context= av_log2(2*FFABS(left->my - top->my)) + 0*av_log2(2*FFABS(tr->my - top->my));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment