Opened 3 years ago

Last modified 2 years ago

#6262 closed change

Favicon retrieval crashes the app — at Initial Version

Reported by: dzhang Assignee:
Priority: Unknown Milestone: Adblock-Plus-for-iOS-next
Module: Adblock-Plus-for-iOS/macOS Keywords:
Cc: Blocked By:
Blocking: #6261 Platform: iOS
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29721690/

Description

Background

A few problems were found with the addition of the FavIcon library version 2.0.1.

  • FavIcon library is not in Embedded Binaries - The app crashes upon accessing the Action Extension
  • FavIcon.framework is in Recovered Frameworks
  • When the FavIcon library is added to Embedded Binaries, a crash occurs when the FavIcon library attempts to retrieve favicons when tested with boston.com and yahoo.com. A sample stack trace has been added below.

`
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 org.bitserf.FavIcon 0x0000000108a8c8c3 specialized closure #1 in static FavIcon.chooseIcon(_:width:height:) + 419 (FavIcon.swift:306)
1 org.bitserf.FavIcon 0x0000000108a8c68f partial apply for closure #1 in static FavIcon.chooseIcon(_:width:height:) + 79
2 org.bitserf.FavIcon 0x0000000108a8c705 partial apply for thunk for @callee_owned (@owned DetectedIcon, @owned DetectedIcon) -> (@unowned Bool, @error @owned Error) + 69
3 org.bitserf.FavIcon 0x0000000108a88126 specialized _insertionSort<A>(_:subRange:by:) + 214
4 org.bitserf.FavIcon 0x0000000108a87d9b specialized _introSortImpl<A>(_:subRange:by:depthLimit:) + 75
5 org.bitserf.FavIcon 0x0000000108a87d27 specialized closure #1 in MutableCollection<A>.sort(by:) + 151
6 org.bitserf.FavIcon 0x0000000108a8b39b specialized MutableCollection<A>.sort(by:) + 139
7 org.bitserf.FavIcon 0x0000000108a8b4f3 specialized static FavIcon.chooseIcon(_:width:height:) + 243
8 org.bitserf.FavIcon 0x0000000108a8b657 specialized closure #1 in static FavIcon.downloadPreferred(_:width:height:completion:) + 39 (FavIcon.swift:221)
9 org.bitserf.FavIcon 0x0000000108a8abd3 partial apply for closure #1 in static FavIcon.downloadPreferred(_:width:height:completion:) + 83
10 org.bitserf.FavIcon 0x0000000108a850d0 closure #2 in closure #4 in static FavIcon.scan(_:completion:) + 96
11 org.bitserf.FavIcon 0x0000000108a8cff2 partial apply for closure #2 in closure #4 in static FavIcon.scan(_:completion:) + 82
12 org.bitserf.FavIcon 0x0000000108a8cf70 partial apply for closure #2 in closure #4 in static FavIcon.scan(_:completion:) + 16
13 org.bitserf.FavIcon 0x0000000108a8d790 thunk for @callee_owned () -> () + 32
14 libdispatch.dylib 0x000000010d3b5177 _dispatch_call_block_and_release + 12
15 libdispatch.dylib 0x000000010d3b61ba _dispatch_client_callout + 8
16 libdispatch.dylib 0x000000010d3c03a4 _dispatch_main_queue_callback_4CF + 1260
17 com.apple.CoreFoundation 0x0000000109a19e39 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9
18 com.apple.CoreFoundation 0x00000001099de462 CFRunLoopRun + 2402
19 com.apple.CoreFoundation 0x00000001099dd889 CFRunLoopRunSpecific + 409
20 com.apple.GraphicsServices 0x000000010f6029c6 GSEventRunModal + 62
21 com.apple.UIKit 0x000000010a10f5d6 UIApplicationMain + 159
22 libxpc.dylib 0x000000010d782b50 _xpc_objc_main + 491
23 libxpc.dylib 0x000000010d784ff0 xpc_main + 143
24 com.apple.Foundation 0x0000000108b38091 -[NSXPCListener resume] + 165
25 com.apple.pluginkit.framework 0x0000000110ede1ef -[PKService run] + 709
26 com.apple.pluginkit.framework 0x0000000110edddf6 +[PKService main] + 55
27 com.apple.pluginkit.framework 0x0000000110ede213 +[PKService _defaultRun:arguments:] + 17
28 com.apple.Foundation 0x0000000108be931a NSExtensionMain + 51
29 libdyld.dylib 0x000000010d42ad81 start + 1

`

What to change

  • Add the FavIcon library to the Embedded Binaries for the AdblockPlusSafari target.
  • Move FavIcon.framework to Frameworks group
  • Deleted Recovered Frameworks group
  • Prevent crashing in chooseIcon in FavIcon library. There are many instances of forced unwrapping in that function.

Change History (0)

Note: See TracTickets for help on using tickets.