!1 json-c: bugfix in oss-fuzz
Merge pull request !1 from orange-snn/master
This commit is contained in:
commit
36f802262e
29
json-c-bugfix-against-INT64_MAX.patch
Normal file
29
json-c-bugfix-against-INT64_MAX.patch
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
From d0b87ee87b282e9b91a1af924050e217b0b2ae8b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Eric Haszlakiewicz <erh+git@nimenees.com>
|
||||||
|
Date: Mon, 12 Aug 2019 00:30:45 +0000
|
||||||
|
Subject: [PATCH] Add an explicit cast to double to squash a
|
||||||
|
-Wimplicit-int-float-conversion warning. Though we will no longer be
|
||||||
|
comparing exactly against INT64_MAX, this is ok because any value of that
|
||||||
|
magnitude stored in a double will *also* have been rounded up, so the
|
||||||
|
comparison will work appropriately.
|
||||||
|
|
||||||
|
---
|
||||||
|
json_object.c | 4 +++-
|
||||||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/json_object.c b/json_object.c
|
||||||
|
index 026dab313b..192919f460 100644
|
||||||
|
--- a/json_object.c
|
||||||
|
+++ b/json_object.c
|
||||||
|
@@ -701,7 +701,9 @@ int64_t json_object_get_int64(const struct json_object *jso)
|
||||||
|
case json_type_int:
|
||||||
|
return jso->o.c_int64;
|
||||||
|
case json_type_double:
|
||||||
|
- if (jso->o.c_double >= INT64_MAX)
|
||||||
|
+ // INT64_MAX can't be exactly represented as a double
|
||||||
|
+ // so cast to tell the compiler it's ok to round up.
|
||||||
|
+ if (jso->o.c_double >= (double)INT64_MAX)
|
||||||
|
return INT64_MAX;
|
||||||
|
if (jso->o.c_double <= INT64_MIN)
|
||||||
|
return INT64_MIN;
|
||||||
|
|
||||||
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
Name: json-c
|
Name: json-c
|
||||||
Version: 0.13.1
|
Version: 0.13.1
|
||||||
Release: 4
|
Release: 5
|
||||||
Summary: JSON implementation in C
|
Summary: JSON implementation in C
|
||||||
|
|
||||||
License: MIT
|
License: MIT
|
||||||
@ -25,7 +25,7 @@ Patch6003: 0053-Fix-compiler-warnings.patch
|
|||||||
Patch6004: 0002-Issue-486-append-a-missing-.0-to-negative-double-val.patch
|
Patch6004: 0002-Issue-486-append-a-missing-.0-to-negative-double-val.patch
|
||||||
|
|
||||||
Patch9000: bugfix-json-c-support_aarch64.patch
|
Patch9000: bugfix-json-c-support_aarch64.patch
|
||||||
|
Patch6005: json-c-bugfix-against-INT64_MAX.patch
|
||||||
BuildRequires: libtool
|
BuildRequires: libtool
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -114,5 +114,8 @@ end
|
|||||||
%doc %{_pkgdocdir}
|
%doc %{_pkgdocdir}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Mar 3 2020 songnannan<songnannan2@huawei.com> - 0.13.1-5
|
||||||
|
- bugfix in oss-fuzz
|
||||||
|
|
||||||
* Thu Sep 19 2019 openEuler Buildteam <buildteam@openeuler.org> - 0.13.1-4
|
* Thu Sep 19 2019 openEuler Buildteam <buildteam@openeuler.org> - 0.13.1-4
|
||||||
- Package init
|
- Package init
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user