Re: [plugins] apple-trailers: handle bad formatted runtime tag



On Thu,  2 Sep 2010 17:49:05 +0200, Víctor Manuel Jáquez Leal
<vjaquez igalia com> wrote:
> Currently the returned xml file has a registry with runtime 2?18, instead of
> the expected 2:18. And that bad formatting crashes the application.
> 
> Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez igalia com>
> ---
>  src/apple-trailers/grl-apple-trailers.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/apple-trailers/grl-apple-trailers.c
> b/src/apple-trailers/grl-apple-trailers.c
> index 58d00df..418f08b 100644
> --- a/src/apple-trailers/grl-apple-trailers.c
> +++ b/src/apple-trailers/grl-apple-trailers.c
> @@ -201,8 +201,10 @@ runtime_to_seconds (const gchar *runtime)
>      return 0;
>    }
>  
> -  items = g_strsplit (runtime, ":", -1);
> -  seconds = 3600 * atoi (items[0]) + 60 * atoi (items[1]);
> +  seconds = 0;
> +  items = g_strsplit (runtime, ":?", -1);
> +  if (items && items[0] && items[1])
> +    seconds = 3600 * atoi (items[0]) + 60 * atoi (items[1]);
>    g_strfreev (items);
>  
>    return seconds;


Isn't that "?" character an error on their side? I mean, should we
really check for both ":" and "?" as if "?" was a valid time separator
or should we just check for ":" only and just ignore the runtime data if
there is no ":" there?

Iago


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]