summaryrefslogtreecommitdiff
path: root/libswscale
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-10-17 13:39:28 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-10-17 14:02:43 +0200
commitd0a3bc13025baab8d48cbcf4c698daf2f0c44adc (patch)
treeab94119233141dd2ebd8e5d34fbbf4372576751f /libswscale
parent2db65472376ce9abdf39ea31eb169278d77a8ac9 (diff)
swscale/yuv2rgb: clip cy, avoid division by 0 with 0 contrast
Found-by: durandal_1707 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale')
-rw-r--r--libswscale/yuv2rgb.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
index c0263cdfb5..77c56a9772 100644
--- a/libswscale/yuv2rgb.c
+++ b/libswscale/yuv2rgb.c
@@ -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);
//scale coefficients by cy
- crv = ((crv << 16) + 0x8000) / cy;
- cbu = ((cbu << 16) + 0x8000) / cy;
- cgu = ((cgu << 16) + 0x8000) / cy;
- cgv = ((cgv << 16) + 0x8000) / cy;
+ crv = ((crv << 16) + 0x8000) / FFMAX(cy, 1);
+ cbu = ((cbu << 16) + 0x8000) / FFMAX(cy, 1);
+ cgu = ((cgu << 16) + 0x8000) / FFMAX(cy, 1);
+ cgv = ((cgv << 16) + 0x8000) / FFMAX(cy, 1);
av_freep(&c->yuvTable);