Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18532] iOS: Application crash from advertising content in WebView

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-03-27T16:44:23.000+0000
Affected Version/sn/a
Fix Version/sRelease 4.0.0
ComponentsiOS
Labelsn/a
ReporterEduardo Gomez
AssigneeIngo Muschenetz
Created2015-02-06T16:30:21.000+0000
Updated2015-03-27T16:44:23.000+0000

Description

Issue Description

While attempting to serve ads inside a WebView using Google Publisher Tags with an mRaid payload the app crashes.

Steps to replicate

Drop the sample code below in app.js and get it to run at device. Reproduced on iPhone 5s iOS 8.1

Sample Code

Titanium.UI.setBackgroundColor('#000');
var webview = Titanium.UI.createWebView();
webview.html = '<html><head><meta name="viewport" content="width=300,user-scalable=no,initial-scale=1" /><script type="text/javascript">             var googletag = googletag || {};             googletag.cmd = googletag.cmd || [];             (function() {               var gads = document.createElement("script");               gads.async = true;               gads.type = "text/javascript";               var useSSL = "https:" == document.location.protocol;               gads.src = (useSSL ? "https:" : "http:") + "//www.googletagservices.com/tag/js/gpt.js";               var node =document.getElementsByTagName("script")[0];               node.parentNode.insertBefore(gads, node);              })();            </script><script type="text/javascript">              googletag.cmd.push(function() {                googletag.pubads().set("adsense_background_color", "FFFFFF");              });            </script><script type="text/javascript">                googletag.cmd.push(function() {                  googletag.defineSlot("/5887/teststg.5887.ignites/mobileapp", [300, 250],"ipadmpu")                  .addService(googletag.pubads());                  googletag.pubads().enableSingleRequest();                  googletag.pubads().collapseEmptyDivs();                  googletag.enableServices();              });            </script></head><body><div id="ipadmpu" class="adSlot"></div><script type="text/javascript">googletag.cmd.push(function() { googletag.display("ipadmpu");});</script></body></html>';
var window = Titanium.UI.createWindow();
window.add(webview);
window.open({
	modal : true
}); 

Xcode console output 3.5.0.GA SDK

Feb  6 10:20:45 iPhone-5s locationd[55] <Notice>: Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0
Feb  6 10:20:45 iPhone-5s Super.Simple[174] <Error>: assertion failed: 12B411: libxpc.dylib + 71820 [AD580443-238D-3997-8D09-004C210D0C18]: 0x7d
Feb  6 10:20:45 iPhone-5s Unknown[174] <Error>: 
Feb  6 10:20:45 iPhone-5s Super.Simple[174] <Warning>: [DEBUG] Reading stylesheet from: /private/var/mobile/Containers/Bundle/Application/BCC4EAE9-12C9-4C43-9635-ED9EFAF4DE50/Super.Simple.app/stylesheet.plist
Feb  6 10:20:45 iPhone-5s Super.Simple[174] <Warning>: [INFO] Super.Simple/1.0 (3.5.0.0014f83)
Feb  6 10:20:45 iPhone-5s Super.Simple[174] <Warning>: [DEBUG] Loading: /private/var/mobile/Containers/Bundle/Application/BCC4EAE9-12C9-4C43-9635-ED9EFAF4DE50/Super.Simple.app/app.js, Resource: app_js
Feb  6 10:20:45 iPhone-5s Super.Simple[174] <Warning>: [DEBUG] Loading: /private/var/mobile/Containers/Bundle/Application/BCC4EAE9-12C9-4C43-9635-ED9EFAF4DE50/Super.Simple.app/_app_props_.json, Resource: _app_props__json
Feb  6 10:20:45 iPhone-5s Super.Simple[174] <Warning>: [DEBUG] Application booted in 133.444965 ms
Feb  6 10:20:45 iPhone-5s Super.Simple[174] <Warning>: [DEBUG] New scheme: <NSMutableURLRequest: 0x17001eac0> { URL: file:///private/var/mobile/Containers/Bundle/Application/BCC4EAE9-12C9-4C43-9635-ED9EFAF4DE50/Super.Simple.app/ }
Feb  6 10:20:45 iPhone-5s Super.Simple[174] <Warning>: [DEBUG] New scheme: <NSMutableURLRequest: 0x17001eba0> { URL: file:///private/var/mobile/Containers/Bundle/Application/BCC4EAE9-12C9-4C43-9635-ED9EFAF4DE50/Super.Simple.app/ }
Feb  6 10:20:45 iPhone-5s Super.Simple[174] <Warning>: [DEBUG] New scheme: <NSMutableURLRequest: 0x174019200> { URL: http://tpc.googlesyndication.com/safeframe/1-0-1/html/container.html }
Feb  6 10:20:46 iPhone-5s locationd[55] <Notice>: Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0
Feb  6 10:20:49 iPhone-5s cloudd[156] <Notice>: (Note ) MC: User has completed cloud configuration. Not showing UI again.
Feb  6 10:20:51 iPhone-5s Super.Simple[174] <Warning>: [ERROR] The application has crashed with an uncaught exception 'NSRangeException'.
	Reason:
	*** -[__NSCFString substringFromIndex:]: Index 104 out of bounds; string length 103
	Stack trace:
	
	0   CoreFoundation                      0x000000018409de48 <redacted> + 132
	1   libobjc.A.dylib                     0x00000001947900e4 objc_exception_throw + 60
	2   CoreFoundation                      0x000000018409dd88 <redacted> + 0
	3   Foundation                          0x0000000184ea81c0 <redacted> + 136
	4   Super.Simple                        0x000000010008060c Super.Simple + 312844
	5   Super.Simple                        0x0000000100116d04 Super.Simple + 929028
	6   CFNetwork                           0x0000000183ae8d54 <redacted> + 72
	7   CFNetwork                           0x0000000183a02fe0 <redacted> + 32
	8   CFNetwork                           0x0000000183a02fa4 <redacted> + 76
	9   CoreFoundation                      0x0000000183f80bfc CFArrayApplyFunction + 68
	10  CFNetwork                           0x0000000183a02e50 <redacted> + 136
	11  CFNetwork                           0x0000000183a02d04 <redacted> + 312
	12  CFNetwork                           0x0000000183a02b30 <redacted> + 68
	13  CoreFoundation                      0x00000001840560e8 <redacted> + 24
	14  CoreFoundation                      0x000000018405538c <redacted> + 264
	15  CoreFoundation                      0x000000018405343c <redacted> + 712
	16  CoreFoundation                      0x0000000183f811f4 CFRunLoopRunSpecific + 396
	17  WebCore                             0x0000000191b5be08 <redacted> + 288
	18  JavaScriptCore                      0x0000000185504b80 <redacted> + 24
	19  libsystem_pthread.dylib             0x0000000194fb3e80 <redacted> + 164
	20  libsystem_pthread.dylib             0x0000000194fb3ddc <redacted> + 0
	21  libsystem_pthread.dylib             0x0000000194fb0fb0 thread_start + 4
Feb  6 10:20:51 iPhone-5s Super.Simple[174] <Error>: *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSCFString substringFromIndex:]: Index 104 out of bounds; string length 103'
	*** First throw call stack:
	(0x18409de48 0x1947900e4 0x18409dd88 0x184ea81c0 0x10008060c 0x100116d04 0x183ae8d54 0x183a02fe0 0x183a02fa4 0x183f80bfc 0x183a02e50 0x183a02d04 0x183a02b30 0x1840560e8 0x18405538c 0x18405343c 0x183f811f4 0x191b5be08 0x185504b80 0x194fb3e80 0x194fb3ddc 0x194fb0fb0)
Feb  6 10:20:51 iPhone-5s ReportCrash[176] <Error>: task_set_exception_ports(B07, 400, D03, 0, 0) failed with error (4: (os/kern) invalid argument)
Feb  6 10:20:51 iPhone-5s ReportCrash[176] <Notice>: ReportCrash acting against PID 174
Feb  6 10:20:52 iPhone-5s ReportCrash[176] <Notice>: Formulating crash report for process Super.Simple[174]
Feb  6 10:20:52 iPhone-5s mediaserverd[19] <Notice>: '' com.appc.test(pid = 174) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_None
Feb  6 10:20:52 iPhone-5s com.apple.xpc.launchd[1] (UIKitApplication:com.appc.test[0xc0c5][174]) <Notice>: Service exited due to signal: Abort trap: 6
Feb  6 10:20:53 iPhone-5s SpringBoard[48] <Warning>: [MPUSystemMediaControls] Updating supported commands for now playing application.
Feb  6 10:20:53 iPhone-5s SpringBoard[48] <Warning>: [MPUSystemMediaControls] Updating supported commands for now playing application.
Feb  6 10:20:53 iPhone-5s SpringBoard[48] <Warning>: Unable to get short BSD proc info for 174: No such process
Feb  6 10:20:53 iPhone-5s SpringBoard[48] <Warning>: Unable to get short BSD proc info for 174: No such process
Feb  6 10:20:53 iPhone-5s ReportCrash[176] <Notice>: Saved report to /var/mobile/Library/Logs/CrashReporter/Super.Simple_2015-02-06-102051_iPhone-5s.ips
Feb  6 10:20:53 iPhone-5s SpringBoard[48] <Warning>: Application 'UIKitApplication:com.appc.test[0xc0c5]' crashed.
Feb  6 10:20:53 iPhone-5s assertiond[58] <Warning>: pid_suspend failed for <BKNewProcess: 0x14dd18a80; com.appc.test; pid: 174>: Unknown error: -1, Unknown error: -1
Feb  6 10:20:53 iPhone-5s assertiond[58] <Warning>: Could not set priority of <BKNewProcess: 0x14dd18a80; com.appc.test; pid: 174> to 2, priority: No such process
Feb  6 10:20:53 iPhone-5s assertiond[58] <Warning>: Could not set priority of <BKNewProcess: 0x14dd18a80; com.appc.test; pid: 174> to 4096, priority: No such process
Feb  6 10:20:53 iPhone-5s UserEventAgent[17] <Warning>: id=com.appc.test pid=174, state=0

Attachments

FileDateSize
iPhone 5s 2015-02-06.png2015-02-06T16:36:34.000+000064894

Comments

  1. Eduardo Gomez 2015-02-06

    Ingo, I've just tried the 4.0.0 release and the app does not crash. Some errors are thrown though.

    Xcode Console output 4.0.0.v20150205163226

       Feb  6 10:24:47 iPhone-5s Super.Simple[181] <Error>: assertion failed: 12B411: libxpc.dylib + 71820 [AD580443-238D-3997-8D09-004C210D0C18]: 0x7d
       Feb  6 10:24:47 iPhone-5s Unknown[181] <Error>: 
       Feb  6 10:24:47 iPhone-5s Super.Simple[181] <Warning>: [DEBUG] Reading stylesheet from: /private/var/mobile/Containers/Bundle/Application/7CAF5577-E69D-4BB5-A770-1198E8DC51DF/Super.Simple.app/stylesheet.plist
       Feb  6 10:24:47 iPhone-5s Super.Simple[181] <Warning>: [INFO] Super.Simple/1.0 (4.0.0.bdbec4a)
       Feb  6 10:24:47 iPhone-5s Super.Simple[181] <Warning>: [DEBUG] Loading: /private/var/mobile/Containers/Bundle/Application/7CAF5577-E69D-4BB5-A770-1198E8DC51DF/Super.Simple.app/app.js, Resource: app_js
       Feb  6 10:24:47 iPhone-5s Super.Simple[181] <Warning>: [DEBUG] Loading: /private/var/mobile/Containers/Bundle/Application/7CAF5577-E69D-4BB5-A770-1198E8DC51DF/Super.Simple.app/_app_props_.json, Resource: _app_props__json
       Feb  6 10:24:47 iPhone-5s Super.Simple[181] <Warning>: [DEBUG] Application booted in 139.373004 ms
       Feb  6 10:24:47 iPhone-5s Super.Simple[181] <Warning>: [DEBUG] New scheme: <NSMutableURLRequest: 0x17001f870> { URL: file:///private/var/mobile/Containers/Bundle/Application/7CAF5577-E69D-4BB5-A770-1198E8DC51DF/Super.Simple.app/ }
       Feb  6 10:24:47 iPhone-5s locationd[55] <Notice>: Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0
       Feb  6 10:24:48 iPhone-5s backboardd[51] <Warning>: CoreAnimation: timed out fence 2ab07
       Feb  6 10:24:48 iPhone-5s backboardd[51] <Warning>: CoreAnimation: updates deferred for too long
       Feb  6 10:24:48 iPhone-5s Super.Simple[181] <Warning>: [DEBUG] New scheme: <NSMutableURLRequest: 0x170200c00> { URL: file:///private/var/mobile/Containers/Bundle/Application/7CAF5577-E69D-4BB5-A770-1198E8DC51DF/Super.Simple.app/ }
       Feb  6 10:24:48 iPhone-5s Super.Simple[181] <Warning>: [DEBUG] New scheme: <NSMutableURLRequest: 0x174208940> { URL: http://tpc.googlesyndication.com/safeframe/1-0-1/html/container.html }
       Feb  6 10:24:50 iPhone-5s Super.Simple[181] <Warning>: [DEBUG] Loading: /activeview, Resource: activeview
       Feb  6 10:24:50 iPhone-5s Super.Simple[181] <Warning>: [ERROR] Error loading /activeview
       
  2. BABLY DAS 2015-03-20

    Hi, I am building an iPhone app Details - Titanium CLI Version : 3.4.2, Titanium CLI Version : 3.5.0, Target Platform : iPhone, OS - MacOSX 10.10 While trying to open a webview in a Window I am also getting a similar error : The application has crashed with an uncaught exception 'NSRangeException'. [ERROR] : Reason: [ERROR] : *** -[__NSCFString substringFromIndex:]: Index 184 out of bounds; string length 183 Stack trace: [ERROR] : [ERROR] : 0 CoreFoundation 0x0550092a __exceptionPreprocess + 154 [ERROR] : 1 libobjc.A.dylib 0x050d2a97 objc_exception_throw + 44 [ERROR] : 2 CoreFoundation 0x0550086d +[NSException raise:format:] + 141 [ERROR] : 3 Foundation 0x0224eec1 -[NSString substringFromIndex:] + 133 [ERROR] : 4 Vantage Circle 0x000be1ea +[TiUtils loadAppResource:] + 346 [ERROR] : 5 Vantage Circle 0x001df142 -[LocalProtocolHandler startLoading] + 418 [ERROR] : 6 CFNetwork 0x03c202eb _ZN16CFURLProtocol_NS29_protocolInterface_resumeLoadEv + 55 [ERROR] : 7 CFNetwork 0x03cf99af ___ZN19URLConnectionLoader27_private_ScheduleOriginLoadEPK12NSURLRequestPK20_CFCachedURLResponse_block_invoke_2 + 62 [ERROR] : 8 CFNetwork 0x03bf9700 ___ZNK19URLConnectionLoader25withExistingProtocolAsyncEU13block_pointerFvP11URLProtocolE_block_invoke + 30 [ERROR] : 9 CFNetwork 0x03bf96bc _ZN19RunloopBlockContext13_invoke_blockEPKvPv + 70 [ERROR] : 10 CoreFoundation 0x053f53d9 CFArrayApplyFunction + 57 [ERROR] : 11 CFNetwork 0x03bf957d _ZN19RunloopBlockContext7performEv + 149 [ERROR] : 12 CFNetwork 0x03d4edc6 _ZThn16_N19RunloopBlockContext24multiplexerClientPerformEv + 20 [ERROR] : 13 CFNetwork 0x03bf93c0 _ZN17MultiplexerSource7performEv + 292 [ERROR] : 14 CFNetwork 0x03bf91dc _ZN17MultiplexerSource8_performEPv + 76 [ERROR] : 15 CoreFoundation 0x054241df __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15 [ERROR] : 16 CoreFoundation 0x05419ced __CFRunLoopDoSources0 + 253 [ERROR] : 17 CoreFoundation 0x05419248 __CFRunLoopRun + 952 [ERROR] : 18 CoreFoundation 0x05418bcb CFRunLoopRunSpecific + 443 [ERROR] : 19 CoreFoundation 0x054189fb CFRunLoopRunInMode + 123 [ERROR] : 20 WebCore 0x0acb9ff8 _ZN7WebCoreL15runLoaderThreadEPv + 456 [ERROR] : 21 JavaScriptCore 0x0c7c172c _ZN3WTFL16threadEntryPointEPv + 76 [ERROR] : 22 JavaScriptCore 0x0c7c1a45 _ZN3WTFL19wtfThreadEntryPointEPv + 21 [ERROR] : 23 libsystem_pthread.dylib 0x0627eecf _pthread_body + 138 [ERROR] : 24 libsystem_pthread.dylib 0x0627ee45 _pthread_body + 0 [ERROR] : 25 libsystem_pthread.dylib 0x0627cf0e thread_start + 34 [ERROR] : [ERROR] : 2015-03-20 17:18:49.918 Vantage Circle[93615:639062] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSCFString substringFromIndex:]: Index 184 out of bounds; string length 183' [ERROR] : *** First throw call stack: [ERROR] : ( [ERROR] : 0 CoreFoundation 0x05500946 __exceptionPreprocess + 182 [ERROR] : 1 libobjc.A.dylib 0x050d2a97 objc_exception_throw + 44 [ERROR] : 2 CoreFoundation 0x0550086d +[NSException raise:format:] + 141 [ERROR] : 3 Foundation 0x0224eec1 -[NSString substringFromIndex:] + 133 [ERROR] : 4 Vantage Circle 0x000be1ea +[TiUtils loadAppResource:] + 346 [ERROR] : 5 Vantage Circle 0x001df142 -[LocalProtocolHandler startLoading] + 418 [ERROR] : 6 CFNetwork 0x03c202eb _ZN16CFURLProtocol_NS29_protocolInterface_resumeLoadEv + 55 [ERROR] : 7 CFNetwork 0x03cf99af ___ZN19URLConnectionLoader27_private_ScheduleOriginLoadEPK12NSURLRequestPK20_CFCachedURLResponse_block_invoke_2 + 62 [ERROR] : 8 CFNetwork 0x03bf9700 ___ZNK19URLConnectionLoader25withExistingProtocolAsyncEU13block_pointerFvP11URLProtocolE_block_invoke + 30 [ERROR] : 9 CFNetwork 0x03bf96bc _ZN19RunloopBlockContext13_invoke_blockEPKvPv + 70 [ERROR] : 10 CoreFoundation 0x053f53d9 CFArrayApplyFunction + 57 [ERROR] : 11 CFNetwork 0x03bf957d _ZN19RunloopBlockContext7performEv + 149 [ERROR] : 12 CFNetwork 0x03d4edc6 _ZThn16_N19RunloopBlockContext24multiplexerClientPerformEv + 20 [ERROR] : 13 CFNetwork 0x03bf93c0 _ZN17MultiplexerSource7performEv + 292 [ERROR] : 14 CFNetwork 0x03bf91dc _ZN17MultiplexerSource8_performEPv + 76 [ERROR] : 15 CoreFoundation 0x054241df __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15 [ERROR] : 16 CoreFoundation 0x05419ced __CFRunLoopDoSources0 + 253 [ERROR] : 17 CoreFoundation 0x05419248 __CFRunLoopRun + 952 [ERROR] : 18 CoreFoundation 0x05418bcb CFRunLoopRunSpecific + 443 [ERROR] : 19 CoreFoundation 0x054189fb CFRunLoopRunInMode + 123 [ERROR] : 20 WebCore 0x0acb9ff8 _ZN7WebCoreL15runLoaderThreadEPv + 456 [ERROR] : 21 JavaScriptCore 0x0c7c172c _ZN3WTFL16threadEntryPointEPv + 76 [ERROR] : 22 JavaScriptCore 0x0c7c1a45 _ZN3WTFL19wtfThreadEntryPointEPv + 21 [ERROR] : 23 libsystem_pthread.dylib 0x0627eecf _pthread_body + 138 [ERROR] : 24 libsystem_pthread.dylib 0x0627ee45 _pthread_body + 0 [ERROR] : 25 libsystem_pthread.dylib 0x0627cf0e thread_start + 34 [ERROR] : ) [ERROR] : libc++abi.dylib: terminating with uncaught exception of type NSException Kindly look at the issue. Thanks
  3. Pedro Enrique 2015-03-27

    Closing, fixed in latest release, 4.0.0

JSON Source