Fix #32419: Fixes crash in WebImageDownloader for iOS (#19796)

Fix crash and added validation to WebImageDownloader for iOS
This commit is contained in:
Brandon-T
2023-08-21 16:24:07 -04:00
committed by GitHub
parent 686b50d1d3
commit d26e9141ca
2 changed files with 8 additions and 2 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ OBJC_EXPORT
- (void)downloadImage:(NSURL*)url
completion:(void (^)(UIImage* _Nullable image,
NSInteger httpResponseCode,
NSURL* url))completion;
NSURL* _Nullable url))completion;
+ (nullable UIImage*)imageFromData:(NSData*)data;
@end
+7 -1
View File
@@ -49,8 +49,14 @@ static const float animated_image_frame_delay = 2.0;
completion:(void (^)(UIImage* _Nullable image,
NSInteger httpResponseCode,
NSURL* url))completion {
GURL url_ = net::GURLWithNSURL(url);
if (!url_.is_valid() || url_.is_empty()) {
completion(nullptr, -1, nullptr);
return;
}
image_fetcher_->DownloadImage(
net::GURLWithNSURL(url), WebImage::max_svg_size, WebImage::max_svg_size,
url_, WebImage::max_svg_size, WebImage::max_svg_size,
base::BindOnce(^(int download_id, int http_status_code,
const GURL& request_url,
const std::vector<SkBitmap>& bitmaps,