Skip to content

Commit

Permalink
libjson: Clip to INT32_MIN for json_type_double in json_object_get_in…
Browse files Browse the repository at this point in the history
…t().

json-c/json-c#346
Follow on to r39758.
Found by autofuzz.

git-svn-id: https://svn.osgeo.org/gdal/trunk/gdal@39777 f0d54148-0727-0410-94bb-9a71ac55c965
  • Loading branch information
goatbar committed Aug 8, 2017
1 parent ca7c4e8 commit 224ffa7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ogr/ogrsf_frmts/geojson/libjson/json_object.c
Expand Up @@ -517,6 +517,8 @@ int32_t json_object_get_int(struct json_object *jso)
else
return (int32_t)cint64;
case json_type_double:
if (jso->o.c_double <= INT32_MIN)
return INT32_MIN;
if (jso->o.c_double >= INT32_MAX)
return INT32_MAX;
return (int32_t)jso->o.c_double;
Expand Down

0 comments on commit 224ffa7

Please sign in to comment.