Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix RCTImageBlurUtils.m Greyscale Crash (#37508)
Summary: ## Summary: This PR fixes a kernel crash caused by trying to blur greyscale images, as described in this issue: #35706 (comment) ## Context: The CGImageGetBitsPerPixel(imageRef) == 8 expression checks if each pixel of the image is represented by 8 bits. In an image, each pixel is typically represented by a certain amount of information to store its color. In a grayscale image, for instance, we often use 8 bits per pixel, which allows for 256 different shades of gray (2^8 = 256). The function vImageBoxConvolve_ARGB8888 works with ARGB images (which stands for Alpha, Red, Green, Blue). If the image is only black & white, it means it's a grayscale image, and hence, it is not compatible with this function, causing the kernel crash. To prevent the issue, we should also convert grayscale images to ARGB before processing them. ## Changelog: [IOS] [FIXED] - Fix RCTImageBlurUtils.m Greyscale Crash Pull Request resolved: #37508 Test Plan: ``` <ImageBackground blurRadius={18} source={{uri: 'https://i.scdn.co/image/ab67616d0000b2737663b2f75fe4d8fb2cac8c27'}} /> <ImageBackground blurRadius={5} source={{uri: 'https://i.scdn.co/image/ab67616d0000b273d5a219b270d74a266131df18'}} /> `` Reviewed By: NickGerleman Differential Revision: D46071330 Pulled By: javache fbshipit-source-id: 8c04cbf88d467596c9c8a9de9a380bc10663a0e5
- Loading branch information