1
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-06-16 20:23:53 +02:00
openwrt/package/libs/libjson-c/patches/000-libm.patch
Robert Marko 15d73a26b6 libjson-c: backport security fixes
This backports upstream fixes for the out of bounds write vulnerability in json-c.
It was reported and patches in this upstream PR: https://github.com/json-c/json-c/pull/592

Addresses CVE-2020-12762

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Signed-off-by: Luka Perkov <luka.perkov@sartura.hr>
[bump PKG_RELEASE, rebase patches on top of json-c 0.12]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(backported from commit bc0288b768)
2020-05-16 21:18:50 +02:00

51 lines
1.3 KiB
Diff

--- a/configure.ac
+++ b/configure.ac
@@ -43,12 +43,6 @@ AC_FUNC_MEMCMP
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS(strcasecmp strdup strerror snprintf vsnprintf vasprintf open vsyslog strncasecmp setlocale)
-AC_CHECK_DECLS([INFINITY], [], [], [[#include <math.h>]])
-AC_CHECK_DECLS([nan], [], [], [[#include <math.h>]])
-AC_CHECK_DECLS([isnan], [], [], [[#include <math.h>]])
-AC_CHECK_DECLS([isinf], [], [], [[#include <math.h>]])
-AC_CHECK_DECLS([_isnan], [], [], [[#include <float.h>]])
-AC_CHECK_DECLS([_finite], [], [], [[#include <float.h>]])
#check if .section.gnu.warning accepts long strings (for __warn_references)
AC_LANG_PUSH([C])
--- a/math_compat.h
+++ b/math_compat.h
@@ -1,28 +1,9 @@
#ifndef __math_compat_h
#define __math_compat_h
-/* Define isnan and isinf on Windows/MSVC */
-
-#ifndef HAVE_DECL_ISNAN
-# ifdef HAVE_DECL__ISNAN
-#include <float.h>
-#define isnan(x) _isnan(x)
-# endif
-#endif
-
-#ifndef HAVE_DECL_ISINF
-# ifdef HAVE_DECL__FINITE
-#include <float.h>
-#define isinf(x) (!_finite(x))
-# endif
-#endif
-
-#ifndef HAVE_DECL_NAN
-#error This platform does not have nan()
-#endif
-
-#ifndef HAVE_DECL_INFINITY
-#error This platform does not have INFINITY
-#endif
+#undef isnan
+#define isnan(x) __builtin_isnan(x)
+#undef isinf
+#define isinf(x) __builtin_isinf(x)
#endif