Opened on 01/14/2018 at 01:35:00 AM

Closed on 03/15/2018 at 08:47:40 AM

#6262 closed change (fixed)

Favicon retrieval crashes the Action Extension

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

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

Description (last modified by dzhang)

Background

A few problems were found with the addition of the FavIcon library version 2.0.1 (#4791) when tested on both a simulator and a device running iOS 11.2.x.

  • FavIcon library is not in Embedded Binaries - The result is that the app crashes upon accessing the Action Extension
  • FavIcon.framework is misplaced 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 group Frameworks and delete the Recovered Frameworks group
  • Prevent crashing in chooseIcon in the FavIcon library. There are many instances of forced unwrapping in that function.
  • Update download code to reflect FavIcon 2.0.2 changes.

Attachments (0)

Change History (12)

comment:1 Changed on 01/14/2018 at 01:35:38 AM by dzhang

  • Description modified (diff)

comment:2 Changed on 01/14/2018 at 01:37:43 AM by dzhang

  • Description modified (diff)

comment:3 Changed on 01/14/2018 at 01:41:41 AM by dzhang

  • Description modified (diff)

comment:4 Changed on 01/14/2018 at 04:12:29 AM by dzhang

  • Summary changed from Favicon retrieval crashes the app to Favicon retrieval crashes the Action Extension

comment:5 Changed on 01/15/2018 at 03:12:37 PM by dzhang

  • Blocking 6261 removed
  • Description modified (diff)

comment:6 Changed on 01/15/2018 at 03:29:31 PM by dzhang

  • Description modified (diff)

comment:7 Changed on 01/15/2018 at 03:30:24 PM by dzhang

  • Description modified (diff)

comment:8 Changed on 01/15/2018 at 06:01:37 PM by dzhang

  • Blocked By 6244 added
  • Description modified (diff)

comment:9 Changed on 01/15/2018 at 06:02:34 PM by dzhang

  • Description modified (diff)

comment:10 Changed on 02/28/2018 at 11:22:00 PM by dzhang

  • Description modified (diff)

comment:11 Changed on 03/13/2018 at 03:53:53 PM by ashephard

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:12 Changed on 03/15/2018 at 08:47:40 AM by ashephard

  • Resolution set to fixed
  • Status changed from reviewing to closed

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none).
 
Note: See TracTickets for help on using tickets.