Commit d0a3bc13 authored by Michael Niedermayer's avatar Michael Niedermayer

swscale/yuv2rgb: clip cy, avoid division by 0 with 0 contrast

Found-by: durandal_1707
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 2db65472
...@@ -768,10 +768,10 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], ...@@ -768,10 +768,10 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
c->yuv2rgb_u2b_coeff = (int16_t)roundToInt16(cbu << 13); c->yuv2rgb_u2b_coeff = (int16_t)roundToInt16(cbu << 13);
//scale coefficients by cy //scale coefficients by cy
crv = ((crv << 16) + 0x8000) / cy; crv = ((crv << 16) + 0x8000) / FFMAX(cy, 1);
cbu = ((cbu << 16) + 0x8000) / cy; cbu = ((cbu << 16) + 0x8000) / FFMAX(cy, 1);
cgu = ((cgu << 16) + 0x8000) / cy; cgu = ((cgu << 16) + 0x8000) / FFMAX(cy, 1);
cgv = ((cgv << 16) + 0x8000) / cy; cgv = ((cgv << 16) + 0x8000) / FFMAX(cy, 1);
av_freep(&c->yuvTable); av_freep(&c->yuvTable);
......
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