You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.
Hi, trying to load invalid data as a GIF crashes this code with EXC_BAD_ACCESS. This is due to the unsafe code in delayForImageAtIndex(). Proper checks should be in place and the UIImage.gifWithData() should throw / return nil if invalid data was handed in.
As a quick hack, the following is how I made this 'work' (= not crash):
classfunc delayForImageAtIndex(index:Int, source:CGImageSource!)->Double{vardelay=0.1guardlet cfProperties =CGImageSourceCopyPropertiesAtIndex(source, index,nil)as?NSDictionary,
gifProperties =cfProperties[kCGImagePropertyGIFDictionary asNSString]as?NSDictionaryelse{return delay
}vardelayTime=gifProperties[kCGImagePropertyGIFUnclampedDelayTime asNSString]if delayTime?.doubleValue ==0.0{
delayTime =gifProperties[kCGImagePropertyGIFDelayTime asNSString]}iflet delayTime = delayTime {
delay = delayTime.doubleValue
}if delay <0.1{
delay =0.1 // Make sure they're not too fast
}return delay
}
Also, building for the device, I get the linker error:
ld: framework not found SwiftGifOrigin for architecture arm64
Matti
The text was updated successfully, but these errors were encountered:
I tested your code, but the tests are failing due to failed access of cfProperties.
I would be very grateful if you could fix this error and create a PR? 💯
Hi, trying to load invalid data as a GIF crashes this code with EXC_BAD_ACCESS. This is due to the unsafe code in delayForImageAtIndex(). Proper checks should be in place and the UIImage.gifWithData() should throw / return nil if invalid data was handed in.
As a quick hack, the following is how I made this 'work' (= not crash):
Also, building for the device, I get the linker error:
The text was updated successfully, but these errors were encountered: