From 75f525c93507ec92162e7e6411e6ad15e17f45eb Mon Sep 17 00:00:00 2001 From: c0ntrol Date: Sat, 15 Sep 2018 21:10:48 +0200 Subject: [PATCH] fix possible divide by zero --- veejay-current/veejay-server/libvje/effects/pencilsketch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/veejay-current/veejay-server/libvje/effects/pencilsketch.c b/veejay-current/veejay-server/libvje/effects/pencilsketch.c index 9489ae7a..37ca3069 100644 --- a/veejay-current/veejay-server/libvje/effects/pencilsketch.c +++ b/veejay-current/veejay-server/libvje/effects/pencilsketch.c @@ -105,7 +105,8 @@ typedef uint8_t (*_pcbcr) (uint8_t a, uint8_t b); { a = CLAMP_Y(a); b = CLAMP_Y(b); - if( a == 0 ) a = 1; else if ( b == 0 ) b = 1; + if( a == 0 ) a = 1; + if( b == 0 ) b = 1; int p = 0xff - ((0xff-a) * (0xff-a)) / a; int q = 0xff - ((0xff-b) * (0xff-b)) / b; p = ( 0xff - ((0xff-p) * (0xff - a)) / q);