Crash being reported for ALAssetRepresentation metadata method
Asked Answered
P

1

13

I have some code that wraps an ALAsset object that is retrieved from enumerating the assets in an ALAssetLibrary. I'm getting reports of users encountering crashes with the part of the wrapper object that asks the ALAsset it contains for metadata.

The code that crashes is in this wrapper class and it simply asks for its ALAsset's metadata like so:

[[myAlAsset defaultRepresentation] metadata]; 

Here is a partial stack trace that is representative of the crashes I'm seeing:

0
CoreFoundation   CFDataGetBytePtr + 5
1
PhotoLibraryServices     __46-[PLManagedAsset adjustmentsXMPRepresentation]_block_invoke + 228
2
PhotoLibraryServices     __46-[PLManagedAsset adjustmentsXMPRepresentation]_block_invoke + 228
3
CoreData     developerSubmittedBlockToNSManagedObjectContextPerform + 88
4
CoreData     -[NSManagedObjectContext performBlockAndWait:] + 114
5
PhotoLibraryServices     -[PLManagedAsset adjustmentsXMPRepresentation] + 226
6
AssetsLibrary    __33-[ALAssetRepresentation metadata]_block_invoke + 24
7
AssetsLibrary    __53-[ALAssetRepresentationPrivate _performBlockAndWait:]_block_invoke + 68
8
CoreData     developerSubmittedBlockToNSManagedObjectContextPerform + 88
9
libdispatch.dylib    _dispatch_client_callout + 22
10
libdispatch.dylib    _dispatch_barrier_sync_f_invoke + 26
11
CoreData     -[NSManagedObjectContext performBlockAndWait:] + 106
12
AssetsLibrary    -[ALAssetsLibrary _performBlockAndWait:] + 134
13
AssetsLibrary    -[ALAssetRepresentationPrivate _performBlockAndWait:] + 176
14
AssetsLibrary    -[ALAssetRepresentation metadata] + 464

Does anyone have ideas on what may be going on? The AlAssetLibrary that underlies these assets is saved with a static reference, so it should not be getting cleaned up in memory and so I wouldn't expect the ALAsset to have been invalidated. This issue seems to have started specifically with iOS 7 being released.

The crash itself is EXC_BAD_ACCESS with KERN_INVALID_ADDRESS at 0x0.

Paving answered 3/12, 2013 at 21:41 Comment(7)
We're seeing this recently as well. Looking at the CFDataGetBytePtr at top of the stack, I feel this might be memory-related. Have you found the cause/solution for this?Silin
I'm also seeing this crash in the wild on an iPhone 4S, though I haven't been able to reproduce it. Crashlytics is reporting that the device which crashed had about 45MB of RAM available around when it crashed. It's not necessarily accurate, I'm sure, but just another data point.Cato
As additional info, our logs indicate that this occurs in other device models as well (not just iPhone 4S). But definitely only iOS 7.0 and above.Silin
Does this happen only for images taken using the camera?Watters
In our case we will never know. We only see this crash from our log files and could not reproduce it on our side. If helps, our app only loads assets from ALAssetsGroupSavedPhotos and ALAssetsGroupAlbum so we can rule out the photo stream and other special folders.Silin
Whoa! it goes on reading XMP data which are XML strings. This is a hidden metadata property and happens in retouched images. Why don't you give a try on ImageIO framework to read metadata and see if the crash is occurring.Mosenthal
I have the same problem but cannot reproduce it by myself (just analysing crash reports). Jesly, can you tell more information about reading XMP data please? I just trying to do: [[asset defaultRepresentation] metadata];Odontoid
F
-1

This may have caused because of buffer overflows. Pls check the link of apple website which shows the buffer overflow crash report same as you have. Hope this may help you.

https://developer.apple.com/library/ios/documentation/Security/Conceptual/SecureCodingGuide/Articles/BufferOverflows.html#//apple_ref/doc/uid/TP40002577-SW1

Florafloral answered 20/8, 2014 at 10:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.