From 9f925cee8cd14630d1722fe2a02148e07f53b76b Mon Sep 17 00:00:00 2001 From: Andriy Herasymyuk Date: Wed, 22 Jul 2020 14:30:58 +0300 Subject: [PATCH] Fix heap buffer overflow in UIColor+KVNContrast.m --- KVNProgress/Categories/UIColor+KVNContrast.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/KVNProgress/Categories/UIColor+KVNContrast.m b/KVNProgress/Categories/UIColor+KVNContrast.m index 411bdb0..68712de 100644 --- a/KVNProgress/Categories/UIColor+KVNContrast.m +++ b/KVNProgress/Categories/UIColor+KVNContrast.m @@ -12,8 +12,9 @@ @implementation UIColor (KVNContrast) - (UIStatusBarStyle)statusBarStyleConstrastStyle { - const CGFloat *componentColors = CGColorGetComponents(self.CGColor); - CGFloat darknessScore = (((componentColors[0] * 255) * 299) + ((componentColors[1] * 255) * 587) + ((componentColors[2] * 255) * 114)) / 1000; + CGFloat red, green, blue; + [self getRed:&red green:&green blue:&blue alpha:nil]; + CGFloat darknessScore = (((red * 255) * 299) + ((green * 255) * 587) + ((blue * 255) * 114)) / 1000; if (darknessScore >= 125) { return UIStatusBarStyleDefault;