[SATYR PATCH] json: treat integers as long long

Richard Marko rmarko at redhat.com
Fri May 17 13:38:13 UTC 2013


On 05/17/2013 01:03 PM, Martin Milata wrote:
> The json parser stored integers in long int, preventing backtraces with
> 64-bit addresses to be correctly read on 32-bit machines.
>
> Closes #78.
>
> Signed-off-by: Martin Milata <mmilata at redhat.com>
> ---
>  lib/json.c | 2 +-
>  lib/json.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/json.c b/lib/json.c
> index ddea4de..1e6ab79 100644
> --- a/lib/json.c
> +++ b/lib/json.c
> @@ -460,7 +460,7 @@ sr_json_parse_ex(struct sr_json_settings *settings,
>                              if (top->type == SR_JSON_DOUBLE)
>                                  top->u.dbl = strtod(i, (char**)&i);
>                              else
> -                                top->u.integer = strtol(i, (char**)&i, 10);
> +                                top->u.integer = strtoll(i, (char**)&i, 10);
>  
>                              flags |= flag_next | flag_reproc;
>                          }
> diff --git a/lib/json.h b/lib/json.h
> index a3e208a..99370df 100644
> --- a/lib/json.h
> +++ b/lib/json.h
> @@ -70,7 +70,7 @@ struct sr_json_value
>     union
>     {
>        int boolean;
> -      long integer;
> +      long long integer;
>        double dbl;
>  
>        struct

Fixes the issue, pushed. Thanks!

-- 
Richard Marko



More information about the Crash-catcher mailing list