Crash on jpg image in ImageIO (100% repro)

Originator:nobrien
Number:rdar://26593987 Date Originated:01-Jun-2016 09:13 PM
Status:Open Resolved:Fixed in iOS 10 betas
Product:iOS Product Version:iOS 9
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
Using ImageIO and CoreGraphics, getting the properties of a particular image will crash 100% of the time

Steps to Reproduce:
1) Run Sample project

Expected Results:
No crash, image is shown and image properties are logged

Actual Results:
Crash when getting the image properties

Here's the code outside of the project:

static UIImage *LoadImageFromData(NSData *data, BOOL logImageProperties)
{
    NSDictionary *options = @{ (NSString *)kCGImageSourceShouldCache : @NO };
    CGImageSourceRef imageSourceRef = CGImageSourceCreateIncremental((__bridge CFDictionaryRef)options);
    CGImageSourceUpdateData(imageSourceRef, (__bridge CFDataRef)data, NO);
    if (logImageProperties) {
        // This crashes 100% of the time with the given image resource
        NSDictionary *imageProperties = CFBridgingRelease(CGImageSourceCopyPropertiesAtIndex(imageSourceRef, 0, NULL));
        NSLog(@"%@", imageProperties);
    }
    CGImageRef cgImage = CGImageSourceCreateImageAtIndex(imageSourceRef, 0, NULL);
    UIImage *image = (cgImage) ? [UIImage imageWithCGImage:cgImage scale:[UIScreen mainScreen].scale orientation:UIImageOrientationUp] : nil;
    CFRelease(cgImage);
    CFRelease(imageSourceRef);
    return image;
}

Here's the image URL:
https://pbs.twimg.com/profile_images/1205320369/logo_only_final_reasonably_small.jpg

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!