Date: Thu, 21 May 2020 20:46:07 +0000 (UTC) From: Sunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r536171 - in head/devel/json-c: . files Message-ID: <202005212046.04LKk7Ti067148@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sunpoet Date: Thu May 21 20:46:06 2020 New Revision: 536171 URL: https://svnweb.freebsd.org/changeset/ports/536171 Log: Update to 0.14 Changes: https://github.com/json-c/json-c/blob/master/ChangeLog PR: 246389 Exp-run by: antoine Added: head/devel/json-c/files/patch-CMakeLists.txt (contents, props changed) head/devel/json-c/files/patch-arraylist.c (contents, props changed) head/devel/json-c/files/patch-linkhash.c (contents, props changed) head/devel/json-c/files/patch-printbuf.c (contents, props changed) Deleted: head/devel/json-c/files/patch-tests-test_parse.c Modified: head/devel/json-c/Makefile head/devel/json-c/distinfo head/devel/json-c/files/patch-json_object.c head/devel/json-c/pkg-plist Modified: head/devel/json-c/Makefile ============================================================================== --- head/devel/json-c/Makefile Thu May 21 20:45:59 2020 (r536170) +++ head/devel/json-c/Makefile Thu May 21 20:46:06 2020 (r536171) @@ -2,8 +2,7 @@ # $FreeBSD$ PORTNAME= json-c -PORTVERSION= 0.13.1 -PORTREVISION= 1 +PORTVERSION= 0.14 CATEGORIES= devel MASTER_SITES= https://s3.amazonaws.com/json-c_releases/releases/ \ LOCAL/sunpoet @@ -14,17 +13,14 @@ COMMENT= JSON (JavaScript Object Notation) implementat LICENSE= MIT LICENSE_FILE= ${WRKSRC}/COPYING -USES= autoreconf compiler:c11 cpe libtool pathfix pkgconfig +USES= cmake compiler:c11 cpe -GNU_CONFIGURE= yes -INSTALL_TARGET= install-strip -TEST_TARGET= check +CMAKE_OFF= BUILD_DOCUMENTATION +CMAKE_ON= BUILD_SHARED_LIBS BUILD_STATIC_LIBS DISABLE_WERROR +TEST_TARGET= test USE_LDCONFIG= yes CPE_VENDOR= json-c_project - -post-patch: - @${REINPLACE_CMD} -e 's| -Werror||g' ${WRKSRC}/Makefile.in post-install: ${INSTALL_DATA} ${WRKSRC}/json_object_private.h ${STAGEDIR}${PREFIX}/include/json-c/ Modified: head/devel/json-c/distinfo ============================================================================== --- head/devel/json-c/distinfo Thu May 21 20:45:59 2020 (r536170) +++ head/devel/json-c/distinfo Thu May 21 20:46:06 2020 (r536171) @@ -1,3 +1,3 @@ -TIMESTAMP = 1520527097 -SHA256 (json-c-0.13.1.tar.gz) = b87e608d4d3f7bfdd36ef78d56d53c74e66ab278d318b71e6002a369d36f4873 -SIZE (json-c-0.13.1.tar.gz) = 639425 +TIMESTAMP = 1588350160 +SHA256 (json-c-0.14.tar.gz) = b377de08c9b23ca3b37d9a9828107dff1de5ce208ff4ebb35005a794f30c6870 +SIZE (json-c-0.14.tar.gz) = 321677 Added: head/devel/json-c/files/patch-CMakeLists.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/json-c/files/patch-CMakeLists.txt Thu May 21 20:46:06 2020 (r536171) @@ -0,0 +1,56 @@ +Obtained from: https://github.com/json-c/json-c/commit/8b511c402b73d1d8b195991891c8d44859cb57ec + https://github.com/json-c/json-c/commit/22870ac2bd4cfdd135887ecc8cbbe02e7ef0c34e + https://github.com/json-c/json-c/commit/4f43a077a497f94214645ce9763247ec085e2094 + +--- CMakeLists.txt.orig 2020-04-19 03:39:09 UTC ++++ CMakeLists.txt +@@ -65,6 +65,7 @@ include(GNUInstallDirs) + include(CMakePackageConfigHelpers) + + option(BUILD_SHARED_LIBS "Default to building shared libraries" ON) ++option(BUILD_STATIC_LIBS "Default to building static libraries" ON) + + # Generate a release merge and test it to verify the correctness of republishing the package. + ADD_CUSTOM_TARGET(distcheck +@@ -299,7 +300,7 @@ if ($ENV{VALGRIND}) + endif() + + set(JSON_C_PUBLIC_HEADERS +- ${PROJECT_BINARY_DIR}/config.h ++ # Note: config.h is _not_ included here + ${PROJECT_BINARY_DIR}/json_config.h + + ${PROJECT_SOURCE_DIR}/json.h +@@ -383,7 +384,7 @@ add_library(${PROJECT_NAME} + set_target_properties(${PROJECT_NAME} PROPERTIES + VERSION 5.0.0 + SOVERSION 5) +- ++list(APPEND CMAKE_TARGETS ${PROJECT_NAME}) + # If json-c is used as subroject it set to target correct interface -I flags and allow + # to build external target without extra include_directories(...) + target_include_directories(${PROJECT_NAME} +@@ -392,7 +393,22 @@ target_include_directories(${PROJECT_NAME} + $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}> + ) + +-install(TARGETS ${PROJECT_NAME} ++# Allow to build static and shared libraries at the same time ++if (BUILD_STATIC_LIBS AND BUILD_SHARED_LIBS) ++ set(STATIC_LIB ${PROJECT_NAME}-static) ++ add_library(${STATIC_LIB} STATIC ++ ${JSON_C_SOURCES} ++ ${JSON_C_HEADERS} ++ ) ++ ++ # rename the static library ++ set_target_properties(${STATIC_LIB} PROPERTIES ++ OUTPUT_NAME ${PROJECT_NAME} ++ ) ++ list(APPEND CMAKE_TARGETS ${STATIC_LIB}) ++endif () ++ ++install(TARGETS ${CMAKE_TARGETS} + EXPORT ${PROJECT_NAME}-targets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} Added: head/devel/json-c/files/patch-arraylist.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/json-c/files/patch-arraylist.c Thu May 21 20:46:06 2020 (r536171) @@ -0,0 +1,14 @@ +Obtained from: https://github.com/json-c/json-c/commit/31243e4d1204ef78be34b0fcae73221eee6b83be + +--- arraylist.c.orig 2020-04-19 03:36:00 UTC ++++ arraylist.c +@@ -136,6 +136,9 @@ int array_list_del_idx(struct array_list *arr, size_t + { + size_t i, stop; + ++ /* Avoid overflow in calculation with large indices. */ ++ if (idx > SIZE_T_MAX - count) ++ return -1; + stop = idx + count; + if (idx >= arr->length || stop > arr->length) + return -1; Modified: head/devel/json-c/files/patch-json_object.c ============================================================================== --- head/devel/json-c/files/patch-json_object.c Thu May 21 20:45:59 2020 (r536170) +++ head/devel/json-c/files/patch-json_object.c Thu May 21 20:46:06 2020 (r536171) @@ -1,14 +1,11 @@ ---- json_object.c.orig 2020-02-18 20:12:20 UTC +--- json_object.c.orig 2020-04-19 03:36:00 UTC +++ json_object.c -@@ -698,9 +698,9 @@ int64_t json_object_get_int64(const struct json_object - case json_type_int: - return jso->o.c_int64; - case json_type_double: -- if (jso->o.c_double >= INT64_MAX) -+ if (jso->o.c_double >= (double)INT64_MAX) +@@ -735,7 +735,7 @@ int64_t json_object_get_int64(const struct json_object + // 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) + if (jso->o.c_double <= (double)INT64_MIN) return INT64_MIN; return (int64_t)jso->o.c_double; - case json_type_boolean: + case json_type_boolean: return jso->o.c_boolean; Added: head/devel/json-c/files/patch-linkhash.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/json-c/files/patch-linkhash.c Thu May 21 20:46:06 2020 (r536171) @@ -0,0 +1,37 @@ +Obtained from: https://github.com/json-c/json-c/commit/31243e4d1204ef78be34b0fcae73221eee6b83be + https://github.com/json-c/json-c/commit/519dfe1591d85432986f9762d41d1a883198c157 + +--- linkhash.c.orig 2020-04-19 03:36:00 UTC ++++ linkhash.c +@@ -12,6 +12,7 @@ + + #include "config.h" + ++#include <assert.h> + #include <limits.h> + #include <stdarg.h> + #include <stddef.h> +@@ -499,6 +500,8 @@ struct lh_table *lh_table_new(int size, lh_entry_free_ + int i; + struct lh_table *t; + ++ /* Allocate space for elements to avoid divisions by zero. */ ++ assert(size > 0); + t = (struct lh_table *)calloc(1, sizeof(struct lh_table)); + if (!t) + return NULL; +@@ -577,9 +580,12 @@ int lh_table_insert_w_hash(struct lh_table *t, const v + { + unsigned long n; + +- if (t->count >= t->size * LH_LOAD_FACTOR) +- if (lh_table_resize(t, t->size * 2) != 0) ++ if (t->count >= t->size * LH_LOAD_FACTOR) { ++ /* Avoid signed integer overflow with large tables. */ ++ int new_size = (t->size > INT_MAX / 2) ? INT_MAX : (t->size * 2); ++ if (t->size == INT_MAX || lh_table_resize(t, new_size) != 0) + return -1; ++ } + + n = h % t->size; + Added: head/devel/json-c/files/patch-printbuf.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/json-c/files/patch-printbuf.c Thu May 21 20:46:06 2020 (r536171) @@ -0,0 +1,52 @@ +Obtained from: https://github.com/json-c/json-c/commit/31243e4d1204ef78be34b0fcae73221eee6b83be + +--- printbuf.c.orig 2020-04-19 03:36:00 UTC ++++ printbuf.c +@@ -15,6 +15,7 @@ + + #include "config.h" + ++#include <limits.h> + #include <stdio.h> + #include <stdlib.h> + #include <string.h> +@@ -65,10 +66,16 @@ static int printbuf_extend(struct printbuf *p, int min + + if (p->size >= min_size) + return 0; +- +- new_size = p->size * 2; +- if (new_size < min_size + 8) ++ /* Prevent signed integer overflows with large buffers. */ ++ if (min_size > INT_MAX - 8) ++ return -1; ++ if (p->size > INT_MAX / 2) + new_size = min_size + 8; ++ else { ++ new_size = p->size * 2; ++ if (new_size < min_size + 8) ++ new_size = min_size + 8; ++ } + #ifdef PRINTBUF_DEBUG + MC_DEBUG("printbuf_memappend: realloc " + "bpos=%d min_size=%d old_size=%d new_size=%d\n", +@@ -83,6 +90,9 @@ static int printbuf_extend(struct printbuf *p, int min + + int printbuf_memappend(struct printbuf *p, const char *buf, int size) + { ++ /* Prevent signed integer overflows with large buffers. */ ++ if (size > INT_MAX - p->bpos - 1) ++ return -1; + if (p->size <= p->bpos + size + 1) + { + if (printbuf_extend(p, p->bpos + size + 1) < 0) +@@ -100,6 +110,9 @@ int printbuf_memset(struct printbuf *pb, int offset, i + + if (offset == -1) + offset = pb->bpos; ++ /* Prevent signed integer overflows with large buffers. */ ++ if (len > INT_MAX - offset) ++ return -1; + size_needed = offset + len; + if (pb->size < size_needed) + { Modified: head/devel/json-c/pkg-plist ============================================================================== --- head/devel/json-c/pkg-plist Thu May 21 20:45:59 2020 (r536170) +++ head/devel/json-c/pkg-plist Thu May 21 20:46:06 2020 (r536171) @@ -1,5 +1,4 @@ include/json-c/arraylist.h -include/json-c/bits.h include/json-c/debug.h include/json-c/json.h include/json-c/json_c_version.h @@ -10,12 +9,16 @@ include/json-c/json_object_iterator.h include/json-c/json_object_private.h include/json-c/json_pointer.h include/json-c/json_tokener.h +include/json-c/json_types.h include/json-c/json_util.h include/json-c/json_visit.h include/json-c/linkhash.h include/json-c/printbuf.h +lib/cmake/json-c/json-c-config.cmake +lib/cmake/json-c/json-c-targets-%%CMAKE_BUILD_TYPE%%.cmake +lib/cmake/json-c/json-c-targets.cmake lib/libjson-c.a lib/libjson-c.so -lib/libjson-c.so.4 -lib/libjson-c.so.4.0.0 +lib/libjson-c.so.5 +lib/libjson-c.so.5.0.0 libdata/pkgconfig/json-c.pc
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005212046.04LKk7Ti067148>