You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Patrick Mueller (JIRA)" <ji...@apache.org> on 2012/10/08 23:30:02 UTC

[jira] [Created] (CB-1600) [ios] crash in MobileSpec under 4.3 during file transfer

Patrick Mueller created CB-1600:
-----------------------------------

             Summary: [ios] crash in MobileSpec under 4.3 during file transfer
                 Key: CB-1600
                 URL: https://issues.apache.org/jira/browse/CB-1600
             Project: Apache Cordova
          Issue Type: Bug
          Components: iOS
            Reporter: Patrick Mueller
            Assignee: Andrew Grieve


I've run Mobile Spec under iOS 4.3 (Xcode 4.5.1 on Lion), and noticed a consistent trap.  

The problem occurs in [CDVFileTransfer.m:477|https://github.com/apache/incubator-cordova-ios/blob/master/CordovaLib/Classes/CDVFileTransfer.m#L477] in method {{- (void)connection:(NSURLConnection*)connection didReceiveResponse:(NSURLResponse*)response}}.  

As near as I can tell, from the debugger, the object coming in as the response is not actually an NSHTTPURLResponse, and that's where the crash is - when it asks for the statusCode.  Cast that didn't work, but you don't find out till you try to access something that's not there.

Other debugger info:

response expectedContentLength == -1
response URL == http://cordova-filetransfer.jitsu.com/robots.txt


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CB-1600) [ios] crash in MobileSpec under 4.3 during file transfer

Posted by "Patrick Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-1600?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13472672#comment-13472672 ] 

Patrick Mueller commented on CB-1600:
-------------------------------------

I've added some code which prevents the crash - pre-checking the white list, and extra protection before casting the NSURLResponse to NSHTTPURLResponse, just in case ...

Since I'm not completely comfortable with this code, figured I'd push the commit as a pull request - hopefully someone can review this and make sure it's ok.

https://github.com/apache/incubator-cordova-ios/pull/57
                
> [ios] crash in MobileSpec under 4.3 during file transfer
> --------------------------------------------------------
>
>                 Key: CB-1600
>                 URL: https://issues.apache.org/jira/browse/CB-1600
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>            Reporter: Patrick Mueller
>            Assignee: Andrew Grieve
>
> I've run Mobile Spec under iOS 4.3 (Xcode 4.5.1 on Lion), and noticed a consistent trap.  
> The problem occurs in [CDVFileTransfer.m:477|https://github.com/apache/incubator-cordova-ios/blob/master/CordovaLib/Classes/CDVFileTransfer.m#L477] in method {{- (void)connection:(NSURLConnection*)connection didReceiveResponse:(NSURLResponse*)response}}.  
> As near as I can tell, from the debugger, the object coming in as the response is not actually an NSHTTPURLResponse, and that's where the crash is - when it asks for the statusCode.  Cast that didn't work, but you don't find out till you try to access something that's not there.
> Other debugger info:
> response expectedContentLength == -1
> response URL == http://cordova-filetransfer.jitsu.com/robots.txt

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CB-1600) [ios] crash in MobileSpec under 4.3 during file transfer

Posted by "Patrick Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-1600?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13472491#comment-13472491 ] 

Patrick Mueller commented on CB-1600:
-------------------------------------

Appears to crash in [it("should handle unknown host") in filetransfer.tests.js|https://github.com/apache/incubator-cordova-mobile-spec/blob/master/autotest/tests/filetransfer.tests.js#L228], but only when the specified host - in this case - foobar.apache.org - is not a valid host AND it's not in the whitelist.  If it's in the whitelist, then the test does not crash.

Makes it smell like the problem is in the white-listing.
                
> [ios] crash in MobileSpec under 4.3 during file transfer
> --------------------------------------------------------
>
>                 Key: CB-1600
>                 URL: https://issues.apache.org/jira/browse/CB-1600
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>            Reporter: Patrick Mueller
>            Assignee: Andrew Grieve
>
> I've run Mobile Spec under iOS 4.3 (Xcode 4.5.1 on Lion), and noticed a consistent trap.  
> The problem occurs in [CDVFileTransfer.m:477|https://github.com/apache/incubator-cordova-ios/blob/master/CordovaLib/Classes/CDVFileTransfer.m#L477] in method {{- (void)connection:(NSURLConnection*)connection didReceiveResponse:(NSURLResponse*)response}}.  
> As near as I can tell, from the debugger, the object coming in as the response is not actually an NSHTTPURLResponse, and that's where the crash is - when it asks for the statusCode.  Cast that didn't work, but you don't find out till you try to access something that's not there.
> Other debugger info:
> response expectedContentLength == -1
> response URL == http://cordova-filetransfer.jitsu.com/robots.txt

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CB-1600) [ios] crash in MobileSpec under 4.3 during file transfer

Posted by "Patrick Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-1600?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13472862#comment-13472862 ] 

Patrick Mueller commented on CB-1600:
-------------------------------------

I followed the flow through a few times, looks like doing the cast check is good enough - as near as I can tell.

Committed in https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-ios.git;a=commit;h=70d5b149c7524adbb7d163ee02e2e54c9584c59e
                
> [ios] crash in MobileSpec under 4.3 during file transfer
> --------------------------------------------------------
>
>                 Key: CB-1600
>                 URL: https://issues.apache.org/jira/browse/CB-1600
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>            Reporter: Patrick Mueller
>            Assignee: Andrew Grieve
>             Fix For: 2.2.0
>
>
> I've run Mobile Spec under iOS 4.3 (Xcode 4.5.1 on Lion), and noticed a consistent trap.  
> The problem occurs in [CDVFileTransfer.m:477|https://github.com/apache/incubator-cordova-ios/blob/master/CordovaLib/Classes/CDVFileTransfer.m#L477] in method {{- (void)connection:(NSURLConnection*)connection didReceiveResponse:(NSURLResponse*)response}}.  
> As near as I can tell, from the debugger, the object coming in as the response is not actually an NSHTTPURLResponse, and that's where the crash is - when it asks for the statusCode.  Cast that didn't work, but you don't find out till you try to access something that's not there.
> Other debugger info:
> response expectedContentLength == -1
> response URL == http://cordova-filetransfer.jitsu.com/robots.txt

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (CB-1600) [ios] crash in MobileSpec under 4.3 during file transfer

Posted by "Patrick Mueller (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CB-1600?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Mueller resolved CB-1600.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 2.2.0
         Assignee: Patrick Mueller  (was: Andrew Grieve)
    
> [ios] crash in MobileSpec under 4.3 during file transfer
> --------------------------------------------------------
>
>                 Key: CB-1600
>                 URL: https://issues.apache.org/jira/browse/CB-1600
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>            Reporter: Patrick Mueller
>            Assignee: Patrick Mueller
>             Fix For: 2.2.0
>
>
> I've run Mobile Spec under iOS 4.3 (Xcode 4.5.1 on Lion), and noticed a consistent trap.  
> The problem occurs in [CDVFileTransfer.m:477|https://github.com/apache/incubator-cordova-ios/blob/master/CordovaLib/Classes/CDVFileTransfer.m#L477] in method {{- (void)connection:(NSURLConnection*)connection didReceiveResponse:(NSURLResponse*)response}}.  
> As near as I can tell, from the debugger, the object coming in as the response is not actually an NSHTTPURLResponse, and that's where the crash is - when it asks for the statusCode.  Cast that didn't work, but you don't find out till you try to access something that's not there.
> Other debugger info:
> response expectedContentLength == -1
> response URL == http://cordova-filetransfer.jitsu.com/robots.txt

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CB-1600) [ios] crash in MobileSpec under 4.3 during file transfer

Posted by "Andrew Grieve (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-1600?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13472721#comment-13472721 ] 

Andrew Grieve commented on CB-1600:
-----------------------------------

Main concern about your pull request is that self.viewController should not be cast to CDVViewController*. Any APIs to be made available to plugins should go in CDVCommandDelegate.h.

I think the solution should be to use only your isKindOf check and add a comment about this being the case on 4.3 (doesn't seem to repro on 5.0)


                
> [ios] crash in MobileSpec under 4.3 during file transfer
> --------------------------------------------------------
>
>                 Key: CB-1600
>                 URL: https://issues.apache.org/jira/browse/CB-1600
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>            Reporter: Patrick Mueller
>            Assignee: Andrew Grieve
>
> I've run Mobile Spec under iOS 4.3 (Xcode 4.5.1 on Lion), and noticed a consistent trap.  
> The problem occurs in [CDVFileTransfer.m:477|https://github.com/apache/incubator-cordova-ios/blob/master/CordovaLib/Classes/CDVFileTransfer.m#L477] in method {{- (void)connection:(NSURLConnection*)connection didReceiveResponse:(NSURLResponse*)response}}.  
> As near as I can tell, from the debugger, the object coming in as the response is not actually an NSHTTPURLResponse, and that's where the crash is - when it asks for the statusCode.  Cast that didn't work, but you don't find out till you try to access something that's not there.
> Other debugger info:
> response expectedContentLength == -1
> response URL == http://cordova-filetransfer.jitsu.com/robots.txt

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira