cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shazron <shaz...@gmail.com>
Subject Re: Proposed patch to prevent crash from malformed javascript in 2.4.0rc1
Date Thu, 07 Feb 2013 02:03:52 GMT
Thanks Carl!
We usually do pull requests for this:
http://wiki.apache.org/cordova/ContributorWorkflow
https://help.github.com/articles/using-pull-requests

This is for attribution purposes.

Since it's a very small patch, I suppose you could save the trouble and use
"git format-patch" and attach it in this thread as well. The difference
from git diff is , it includes the contributor info (meta info):
http://stackoverflow.com/questions/4624127/what-is-the-difference-between-git-format-patch-and-git-diff


On Wed, Feb 6, 2013 at 5:34 PM, Carl Peto <carl_peto@dennis.co.uk> wrote:

>
> Dear Cordova,
>
> We recently had a crash in iOS because we accidentally wrote this
> javascript…
>
> Cordova.exec(frontPage.updatePublicationList,frontPage.Error,"MyPlugin","update-list",
> null);
>
> I may have messed up the exact syntax during copy/paste/obfusticate but
> the essence is that passing null for the parameters causes a crash. But it
> is perfectly understandable from a javascript point of view, given that the
> method being called takes no parameters.
>
> Cordova doesn't handle this well yet, at least on iOS.  Can I propose a
> small patch in the iOS code to just defend against this?
>
> diff --git a/CordovaLib/Classes/CDVInvokedUrlCommand.m
> b/CordovaLib/Classes/CDVInvokedUrlCommand.m
> index 6c7a856..e3ca263 100644
> --- a/CordovaLib/Classes/CDVInvokedUrlCommand.m
> +++ b/CordovaLib/Classes/CDVInvokedUrlCommand.m
> @@ -54,12 +54,14 @@
>  {
>      self = [super init];
>      if (self != nil) {
> -        _arguments = arguments;
> +        if ([arguments isKindOfClass:[NSArray class]]) {
> +            _arguments = arguments;
> +            [self massageArguments];
> +        }
>          _callbackId = callbackId;
>          _className = className;
>          _methodName = methodName;
>      }
> -    [self massageArguments];
>      return self;
>  }
>
>
> Thanks and regards.
>
> Carl Peto,
> Dennis Publishing
>
> NOTE: The information in this email is confidential and may be legally
> privileged, unless stated to the contrary. If you are not the intended
> recipient, you must not read, use or disseminate that information.
> Any opinions or comments are personal to the writer and do not represent
> the
> official view of Dennis Publishing Ltd. If you have received this email
> and are not a named addressee, please contact it.director@dennis.co.ukimmediately by
reply email and then delete this message from your system.
> Please do not copy it or use it for any purpose, or disclose its contents
> to any other person.
> Although this email and any attachments are believed to be free of any
> virus, or other defects, it is the responsibility of the recipient to
> ensure that they are virus free and no responsibility is accepted by Dennis
> Publishing Ltd for any loss or damage arising from the receipt or use
> thereof.
> Company registered in England No. 1138891
> Registered office: 30, Cleveland Street, London, W1T 4JD
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message