thunderbird/backport-rnp-0.16.2-to-esr102-k-bug-1790662.patch

3189 lines
134 KiB
Diff
Raw Normal View History

# HG changeset patch
# User Rob Lemley <rob@thunderbird.net>
# Date 1663090875 0
# Tue Sep 13 17:41:15 2022 +0000
# Node ID adfbf6378df82c8b2e087427a48ddc5cbe13aadd
# Parent fbc2cf15893e40959b04d22c9efa4d424aeb5c4f
Bug 1790662 - Update json-c vendored source to 0.16. r=dandarnell
Differential Revision: https://phabricator.services.mozilla.com/D157961
diff --git a/comm/third_party/README.json-c b/comm/third_party/README.json-c
--- a/comm/third_party/README.json-c
+++ b/comm/third_party/README.json-c
@@ -1,19 +1,20 @@
-Directory ./json-c contains a copy of version 0.15 of the json-c library,
-which has been obtained from https://s3.amazonaws.com/json-c_releases/releases/json-c-0.15-nodoc.tar.gz .
+Directory ./json-c contains a copy of version 0.16 of the json-c library,
+which has been obtained from https://s3.amazonaws.com/json-c_releases/releases/json-c-0.16-nodoc.tar.gz .
(Link at https://github.com/json-c/json-c/wiki).
For licensing information, please refer to the included documentation.
The SHA256SUM of the imported file is:
-99bca4f944b8ced8ae0bbc6310d6a3528ca715e69541793a1ef51f8c5b4b0878 json-c-0.15-nodoc.tar.gz
+ac8a3dd6820daaca579b23fbc74664310fbc3d67f52f6707cda67d21dde5570f json-c-0.16-nodoc.tar.gz
The following files and directories were removed from the source distribution's root:
.github/
apps/
bench/
cmake/
+doc/
fuzz/
tests/
.clang-format
.editorconfig
.gitignore
@@ -21,10 +22,12 @@ tests/
Android.configure.mk
CMakeLists.txt
README
appveyor.yml
cmake-configure
+issues_closed_for_0.{13,14,15,16}.md
+json_config.h.win32
json-c.pc.in
json-c.sym
The following files were added to the source's root by MZLA Technologies:
config.h.in (modified copy from cmake/config.h.in)
diff --git a/comm/third_party/json-c/AUTHORS b/comm/third_party/json-c/AUTHORS
--- a/comm/third_party/json-c/AUTHORS
+++ b/comm/third_party/json-c/AUTHORS
@@ -1,30 +1,61 @@
+Alan Coopersmith <alan.coopersmith@oracle.com>
Alexander Dahl <post@lespocky.de>
+Alexandru Ardelean <ardeleanalex@gmail.com>
andy5995 <andy400-dev@yahoo.com>
+Aram Poghosyan <Aram.Poghosyan@teamviewer.com>
Björn Esser <besser82@fedoraproject.org>
+BonsaY <bonsay@posteo.de>
changyong guo <guo1487@163.com>
chenguoping <chenguopingdota@163.com>
+Chris Lamb <lamby@debian.org>
Christopher Head <chead@chead.ca>
Chris Wolfe <chriswwolfe@gmail.com>
C. Watford (christopher.watford@gmail.com)
Darjan Krijan <darjan_krijan@gmx.de>
+David McCann <mccannd@uk.ibm.com>
+DeX77 <dex@dragonslave.de>
+dota17 <chenguopingdota@163.com>
+Eric Haszlakiewicz <erh+git@nimenees.com>
Eric Hawicz <erh+git@nimenees.com>
+Even Rouault <even.rouault@spatialys.com>
+Gianluigi Tiesi <sherpya@netfarm.it>
grdowns <grdowns@microsoft.com>
+Hex052 <elijahiff@gmail.com>
+hofnarr <hofnarr@hofnarr.fi>
+ihsinme <61293369+ihsinme@users.noreply.github.com>
Ivan Romanov <drizt@land.ru>
Jaap Keuter <jaap.keuter@xs4all.nl>
+Jakov Smolic <jakov.smolic@sartura.hr>
janczer <menshikov.ivn@gmail.com>
Jehan <jehan@girinstud.io>
Jehiah Czebotar <jehiah@gmail.com>
Jonathan Wiens <j.wiens@teles.com>
Jose Bollo <jose.bollo@iot.bzh>
+José Bollo <jose.bollo@iot.bzh>
+Juuso Alasuutari <juuso.alasuutari@gmail.com>
Keith Holman <keith.holman@windriver.com>
+Kizuna-Meraki <z9@kizunameraki.de>
+Leon Gross <leon.gross@rub.de>
Liang, Gao <liang.gao@intel.com>
+Marc <34656315+MarcT512@users.noreply.github.com>
max <mpano91@gmail.com>
+Micah Snyder <micasnyd@cisco.com>
Michael Clark <michael@metaparadigm.com>
myd7349 <myd7349@gmail.com>
+Pascal Cuoq <cuoq@trust-in-soft.com>
+Pawday <pawday@mail.ru>
+Philosoph228 <philosoph228@gmail.com>
Pierce Lopez <pierce.lopez@gmail.com>
Po-Chuan Hsieh <sunpoet@sunpoet.net>
Ramiro Polla <ramiro.polla@gmail.com>
Rikard Falkeborn <rikard.falkeborn@gmail.com>
+Robert Bielik <robert.bielik@dirac.com>
Robert <roby_p97@yahoo.com>
+Rosen Penev <rosenp@gmail.com>
Rubasri Kalidas <rubasri.kalidas@intel.com>
+Simon McVittie <smcv@collabora.com>
+ssrlive <30760636+ssrlive@users.noreply.github.com>
+Tobias Nießen <tniessen@users.noreply.github.com>
+Tobias Stoeckmann <tobias@stoeckmann.org>
+Tudor Brindus <me@tbrindus.ca>
Unmanned Player <36690541+unmanned-player@users.noreply.github.com>
diff --git a/comm/third_party/json-c/ChangeLog b/comm/third_party/json-c/ChangeLog
--- a/comm/third_party/json-c/ChangeLog
+++ b/comm/third_party/json-c/ChangeLog
@@ -1,8 +1,62 @@
-Next Release 0.15
-=====================
+0.16 (up to commit 66dcdf5, 2022-04-13)
+========================================
+
+Deprecated and removed features:
+--------------------------------
+* JSON_C_OBJECT_KEY_IS_CONSTANT is deprecated in favor of
+ JSON_C_OBJECT_ADD_CONSTANT_KEY
+* Direct access to lh_table and lh_entry structure members is deprecated.
+ Use access functions instead, lh_table_head(), lh_entry_next(), etc...
+* Drop REFCOUNT_DEBUG code.
+
+New features
+------------
+* The 0.16 release introduces no new features
+
+Build changes
+-------------
+* Add a DISABLE_EXTRA_LIBS option to skip using libbsd
+* Add a DISABLE_JSON_POINTER option to skip compiling in json_pointer support.
+
+Significant changes and bug fixes
+---------------------------------
+* Cap string length at INT_MAX to avoid various issues with very long strings.
+* json_object_deep_copy: fix deep copy of strings containing '\0'
+* Fix read past end of buffer in the "json_parse" command
+* Avoid out of memory accesses in the locally provided vasprintf() function
+ (for those platforms that use it)
+* Handle allocation failure in json_tokener_new_ex
+* Fix use-after-free in json_tokener_new_ex() in the event of printbuf_new() returning NULL
+* printbuf_memset(): set gaps to zero - areas within the print buffer which
+ have not been initialized by using printbuf_memset
+* printbuf: return -1 on invalid arguments (len < 0 or total buffer > INT_MAX)
+* sprintbuf(): propagate printbuf_memappend errors back to the caller
+
+Optimizations
+--------------
+* Speed up parsing by replacing ctype functions with simplified, faster
+ non-locale-sensitive ones in json_tokener and json_object_to_json_string.
+* Neither vertical tab nor formfeed are considered whitespace per the JSON spec
+* json_object: speed up creation of objects, calloc() -> malloc() + set fields
+* Avoid needless extra strlen() call in json_c_shallow_copy_default() and
+ json_object_equal() when the object is known to be a json_type_string.
+
+Other changes
+-------------
+* Validate size arguments in arraylist functions.
+* Use getrandom() if available; with GRND_NONBLOCK to allow use of json-c
+ very early during boot, such as part of cryptsetup.
+* Use arc4random() if it's available.
+* random_seed: on error, continue to next method instead of exiting the process
+* Close file when unable to read from /dev/urandom in get_dev_random_seed()
+
+***
+
+0.15 (up to commit 870965e, 2020/07/26)
+========================================
Deprecated and removed features:
--------------------------------
* Deprecate `array_list_new()` in favor of `array_list_new2()`
* Remove the THIS_FUNCTION_IS_DEPRECATED define.
@@ -57,11 +111,11 @@ Significant changes and bug fixes
Other changes
-------------
* #589 - Detect broken RDRAND during initialization; also, fix segfault
in the CPUID check.
* #592 - Fix integer overflows to prevert out of bounds write on large input.
-* Protect against division by zero in linkhash, when creaed with zero size.
+* Protect against division by zero in linkhash, when created with zero size.
* #602 - Fix json_parse_uint64() internal error checking, leaving the retval
untouched in more failure cases.
* #614 - Prevent truncation when custom double formatters insert extra \0's
@@ -183,11 +237,11 @@ Behavior changes:
See commit 99d8fc
* Use size_t for array length and size. Platforms where sizeof(size_t) != sizeof(int) may not be backwards compatible
See commits 45c56b, 92e9a5 and others.
-* Check for failue when allocating memory, returning NULL and errno=ENOMEM.
+* Check for failure when allocating memory, returning NULL and errno=ENOMEM.
See commit 2149a04.
* Change json_object_object_add() return type from void to int, and will return -1 on failures, instead of exiting. (Note: this is not an ABI change)
New features:
@@ -374,11 +428,11 @@ 0.10
* Add json_object_object_get_ex(), a NULL-safe get object method, to be able
to distinguish between a key not present and the value being NULL.
* Add an alternative iterator implementation, see json_object_iterator.h
* Make json_object_iter public to enable external use of the
json_object_object_foreachC macro.
- * Add a printbuf_memset() function to provide an effecient way to set and
+ * Add a printbuf_memset() function to provide an efficient way to set and
append things like whitespace indentation.
* Adjust json_object_is_type and json_object_get_type so they return
json_type_null for NULL objects and handle NULL passed to
json_objct_object_get().
* Rename boolean type to json_bool.
@@ -460,11 +514,11 @@ 0.8
Geoffrey Young, geoff at modperlcookbook dot org
0.7
===
* Add escaping of backslash to json output
- * Add escaping of foward slash on tokenizing and output
+ * Add escaping of forward slash on tokenizing and output
* Changes to internal tokenizer from using recursion to
using a depth state structure to allow incremental parsing
0.6
===
diff --git a/comm/third_party/json-c/README.html b/comm/third_party/json-c/README.html
--- a/comm/third_party/json-c/README.html
+++ b/comm/third_party/json-c/README.html
@@ -24,16 +24,16 @@
<li>msbuild "json-c.vcxproj" /m /verbosity:normal /p:OutDir=lib\</li>
<li>Or, open the project in Visual Studio</li>
</ul>
<h3>Documentation</h3>
- <P>Doxygen generated documentation exists <a href="http://json-c.github.io/json-c/">here</a>.</P>
+ <P>Doxygen generated documentation exists <a href="https://json-c.github.io/json-c/">here</a>.</P>
<h3><a href="https://github.com/json-c/json-c">GIT Reposository</a></h3>
<p><strong><code>git clone https://github.com/json-c/json-c.git</code></strong></p>
- <h3><a href="http://groups.google.com/group/json-c">Mailing List</a></h3>
+ <h3><a href="https://groups.google.com/group/json-c">Mailing List</a></h3>
<pi>Send email to <strong><code>json-c <i>&lt;at&gt;</i> googlegroups <i>&lt;dot&gt;</i> com</code></strong></p>
<h3><a href="COPYING">License</a></h3>
<p>This program is free software; you can redistribute it and/or modify it under the terms of the MIT License.</p>
<hr/>
diff --git a/comm/third_party/json-c/README.md b/comm/third_party/json-c/README.md
--- a/comm/third_party/json-c/README.md
+++ b/comm/third_party/json-c/README.md
@@ -14,32 +14,39 @@ 6. [Linking to libjson-c](#linking)
7. [Using json-c](#using)
JSON-C - A JSON implementation in C <a name="overview"></a>
-----------------------------------
+JSON-C implements a reference counting object model that allows you to easily
+construct JSON objects in C, output them as JSON formatted strings and parse
+JSON formatted strings back into the C representation of JSON objects.
+It aims to conform to [RFC 7159](https://tools.ietf.org/html/rfc7159).
+
+Skip down to [Using json-c](#using)
+or check out the [API docs](https://json-c.github.io/json-c/),
+if you already have json-c installed and ready to use.
+
+Home page for json-c: https://github.com/json-c/json-c/wiki
+
Build Status
* [AppVeyor Build](https://ci.appveyor.com/project/hawicz/json-c) ![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/json-c/json-c?branch=master&svg=true)
* [Travis Build](https://travis-ci.org/json-c/json-c) ![Travis Build Status](https://travis-ci.org/json-c/json-c.svg?branch=master)
Test Status
* [Coveralls](https://coveralls.io/github/json-c/json-c?branch=master) [![Coverage Status](https://coveralls.io/repos/github/json-c/json-c/badge.svg?branch=master)](https://coveralls.io/github/json-c/json-c?branch=master)
-JSON-C implements a reference counting object model that allows you to easily
-construct JSON objects in C, output them as JSON formatted strings and parse
-JSON formatted strings back into the C representation of JSON objects.
-It aims to conform to [RFC 7159](https://tools.ietf.org/html/rfc7159).
-
Building on Unix with `git`, `gcc` and `cmake` <a name="buildunix"></a>
--------------------------------------------------
-Home page for json-c: https://github.com/json-c/json-c/wiki
+If you already have json-c installed, see [Linking to `libjson-c`](#linking)
+for how to build and link your program against it.
### Prerequisites: <a name="installprereq"></a>
- `gcc`, `clang`, or another C compiler
- - cmake>=2.8, >=3.16 recommended
+ - `cmake>=2.8`, `>=3.16` recommended, `cmake=>3.1` for tests
To generate docs you'll also need:
- `doxygen>=1.8.13`
If you are on a relatively modern system, you'll likely be able to install
@@ -78,11 +85,11 @@ Then:
```
### Generating documentation with Doxygen:
-The libray documentation can be generated directly from the source codes using Doxygen tool:
+The library documentation can be generated directly from the source code using Doxygen tool:
```sh
# in build directory
make doc
google-chrome doc/html/index.html
@@ -184,11 +191,11 @@ make USE_VALGRIND=0 test # optionally
If a test fails, check `Testing/Temporary/LastTest.log`,
`tests/testSubDir/${testname}/${testname}.vg.out`, and other similar files.
If there is insufficient output try:
```sh
-VERBOSE=1 make test
+VERBOSE=1 CTEST_OUTPUT_ON_FAILURE=1 make test
```
or
```sh
JSONC_TEST_TRACE=1 make test
```
@@ -218,42 +225,59 @@ then you can just add this to your `make
```make
CFLAGS += $(shell pkg-config --cflags json-c)
LDFLAGS += $(shell pkg-config --libs json-c)
```
-Without `pkgconfig`, you would do something like this:
+Without `pkgconfig`, you might do something like this:
```make
JSON_C_DIR=/path/to/json_c/install
CFLAGS += -I$(JSON_C_DIR)/include/json-c
+# Or to use lines like: #include <json-c/json_object.h>
+#CFLAGS += -I$(JSON_C_DIR)/include
LDFLAGS+= -L$(JSON_C_DIR)/lib -ljson-c
```
+If your project uses cmake:
+
+* Add to your CMakeLists.txt file:
+
+```cmake
+find_package(json-c CONFIG)
+target_link_libraries(${PROJECT_NAME} PRIVATE json-c::json-c)
+```
+
+* Then you might run in your project:
+
+```sh
+cd build
+cmake -DCMAKE_PREFIX_PATH=/path/to/json_c/install/lib64/cmake ..
+```
Using json-c <a name="using">
------------
-To use json-c you can either include json.h, or preferrably, one of the
+To use json-c you can either include json.h, or preferably, one of the
following more specific header files:
* json_object.h - Core types and methods.
* json_tokener.h - Methods for parsing and serializing json-c object trees.
* json_pointer.h - JSON Pointer (RFC 6901) implementation for retrieving
objects from a json-c object tree.
* json_object_iterator.h - Methods for iterating over single json_object instances. (See also `json_object_object_foreach()` in json_object.h)
* json_visit.h - Methods for walking a tree of json-c objects.
-* json_util.h - Miscelleanous utility functions.
+* json_util.h - Miscellaneous utility functions.
-For a full list of headers see [files.html](http://json-c.github.io/json-c/json-c-current-release/doc/html/files.html)
+For a full list of headers see [files.html](https://json-c.github.io/json-c/json-c-current-release/doc/html/files.html)
The primary type in json-c is json_object. It describes a reference counted
tree of json objects which are created by either parsing text with a
json_tokener (i.e. `json_tokener_parse_ex()`), or by creating
(with `json_object_new_object()`, `json_object_new_int()`, etc...) and adding
(with `json_object_object_add()`, `json_object_array_add()`, etc...) them
individually.
-Typically, every object in the tree will have one reference, from it's parent.
+Typically, every object in the tree will have one reference, from its parent.
When you are done with the tree of objects, you call json_object_put() on just
the root object to free it, which recurses down through any child objects
calling json_object_put() on each one of those in turn.
You can get a reference to a single child
@@ -264,11 +288,11 @@ increment the child's refcount (`json_ob
the parent being freed or it being removed from its parent
(`json_object_object_del()` or `json_object_array_del_idx()`)
When parsing text, the json_tokener object is independent from the json_object
that it returns. It can be allocated (`json_tokener_new()`)
-used ones or multiple times (`json_tokener_parse_ex()`, and
+used one or multiple times (`json_tokener_parse_ex()`, and
freed (`json_tokener_free()`) while the json_object objects live on.
A json_object tree can be serialized back into a string with
`json_object_to_json_string_ext()`. The string that is returned
is only valid until the next "to_json_string" call on that same object.
diff --git a/comm/third_party/json-c/RELEASE_CHECKLIST.txt b/comm/third_party/json-c/RELEASE_CHECKLIST.txt
--- a/comm/third_party/json-c/RELEASE_CHECKLIST.txt
+++ b/comm/third_party/json-c/RELEASE_CHECKLIST.txt
@@ -18,11 +18,18 @@
* https://github.com/lvc/abi-compliance-checker
* If the new release is not backwards compatible, then this is a MAJOR release.
* Mention removed features in ChangeLog
* Consider re-adding backwards compatible support, through symbol
aliases and appropriate entries in json-c.sym
+ * Be sure any new symbols are listed in json-c.sym as part of
+ the _new_ release version.
* Update the AUTHORS file
+
+ PREV=$(git tag | tail -1)
+ ( git log -r ${PREV}..HEAD | grep Author: | sed -e's/Author: //' ; cat AUTHORS ) | sort -u > A1
+ mv A1 AUTHORS
+
* Exclude mentioning changes that have already been included in a point
release of the previous release branch.
* Update ChangeLog with relevant notes before branching.
@@ -31,18 +38,18 @@
* Check that the compile works on Windows - automatic through AppVeyor
## Release creation
Start creating the new release:
- release=0.15
+ release=0.16
git clone https://github.com/json-c/json-c json-c-${release}
mkdir distcheck
cd distcheck
# Note, the build directory *must* be entirely separate from
# the source tree for distcheck to work properly.
- cmake ../json-c-${release}
+ cmake -DCMAKE_BUILD_TYPE=Release ../json-c-${release}
make distcheck
cd ..
Make any fixes/changes *before* branching.
@@ -53,11 +60,10 @@ Make any fixes/changes *before* branchin
------------
Using ${release}:
Update the version in json_c_version.h
Update the version in CMakeLists.txt (VERSION in the project(...) line)
- Update the version in config.h.win32 (several places)
Update the set_target_properties() line in CmakeLists.txt to set the shared
library version. Generally, unless we're doing a major release, change:
VERSION x.y.z
to
@@ -72,23 +78,25 @@ If we're doing a major release (SONAME b
------------
Generate the doxygen documentation:
- doxygen
+ (cd ../distcheck && make doc)
+ cp -r -p ../distcheck/doc/{html,Doxyfile} doc/.
+ rm doc/Doxyfile # Remove generated file w/ hardcoded paths
git add -f doc
- git commit doc
+ git commit doc -m "Generate docs for the ${release} release"
------------
Create the release tarballs:
cd ..
echo .git > excludes
tar -czf json-c-${release}.tar.gz -X excludes json-c-${release}
- echo doc >> excludes
+ echo 'doc/*' >> excludes
tar -czf json-c-${release}-nodoc.tar.gz -X excludes json-c-${release}
------------
Tag the branch:
@@ -102,11 +110,11 @@ Tag the branch:
------------
Go to Amazon S3 service at:
https://console.aws.amazon.com/s3/
-Upload the two tarballs in the json-c_releases folder.
+Upload the two tarballs in the json-c_releases/releases folder.
When uploading, use "Standard" storage class, and make the uploaded files publicly accessible.
Logout of Amazon S3, and verify that the files are visible.
https://s3.amazonaws.com/json-c_releases/releases/index.html
@@ -119,17 +127,18 @@ Post-release checklist:
Add new section to ChangeLog for ${release}+1
Use ${release}.99 to indicate a version "newer" than anything on the branch:
Update the version in json_c_version.h
Update the version in CMakeLists.txt
- Update the version in config.h.win32
Update RELEASE_CHECKLIST.txt, set release=${release}+1
+Add a new empty section to the json-c.sym file, for ${release}+1
+
Update the set_target_properties() line in CmakeLists.txt to match the release branch.
- git commit -a -m "Update the master branch to version 0.${release}.99"
+ git commit -a -m "Update the master branch to version ${release}.99"
git push
------------
Update the gh-pages branch with new docs:
@@ -141,10 +150,12 @@ Update the gh-pages branch with new docs
git clone -b gh-pages https://github.com/json-c/json-c json-c-pages
cd json-c-pages
mkdir json-c-${release}
cp -R ../json-c-${release}/doc json-c-${release}/.
git add json-c-${release}
+ rm json-c-current-release
+ ln -s json-c-${release} json-c-current-release
git commit -a -m "Add the ${release} docs."
vi index.html
# Add/change links to current release.
diff --git a/comm/third_party/json-c/arraylist.c b/comm/third_party/json-c/arraylist.c
--- a/comm/third_party/json-c/arraylist.c
+++ b/comm/third_party/json-c/arraylist.c
@@ -43,10 +43,12 @@ struct array_list *array_list_new(array_
struct array_list *array_list_new2(array_list_free_fn *free_fn, int initial_size)
{
struct array_list *arr;
+ if (initial_size < 0 || (size_t)initial_size >= SIZE_T_MAX / sizeof(void *))
+ return NULL;
arr = (struct array_list *)malloc(sizeof(struct array_list));
if (!arr)
return NULL;
arr->size = initial_size;
arr->length = 0;
@@ -104,10 +106,12 @@ static int array_list_expand_internal(st
int array_list_shrink(struct array_list *arr, size_t empty_slots)
{
void *t;
size_t new_size;
+ if (empty_slots >= SIZE_T_MAX / sizeof(void *) - arr->length)
+ return -1;
new_size = arr->length + empty_slots;
if (new_size == arr->size)
return 0;
if (new_size > arr->size)
return array_list_expand_internal(arr, new_size);
diff --git a/comm/third_party/json-c/arraylist.h b/comm/third_party/json-c/arraylist.h
--- a/comm/third_party/json-c/arraylist.h
+++ b/comm/third_party/json-c/arraylist.h
@@ -13,12 +13,12 @@
* @file
* @brief Internal methods for working with json_type_array objects.
* Although this is exposed by the json_object_get_array() method,
* it is not recommended for direct use.
*/
-#ifndef _arraylist_h_
-#define _arraylist_h_
+#ifndef _json_c_arraylist_h_
+#define _json_c_arraylist_h_
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/comm/third_party/json-c/config.h.in b/comm/third_party/json-c/config.h.in
--- a/comm/third_party/json-c/config.h.in
+++ b/comm/third_party/json-c/config.h.in
@@ -55,10 +55,13 @@
#undef HAVE_SYS_CDEFS_H
/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
+/* Define to 1 if you have the <sys/random.h> header file. */
+#undef HAVE_SYS_RANDOM_H
+
/* Define to 1 if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
@@ -70,10 +73,16 @@
#undef HAVE_UNISTD_H
/* Define to 1 if you have the <xlocale.h> header file. */
#undef HAVE_XLOCALE_H
+/* Define to 1 if you have the <bsd/stdlib.h> header file. */
+#undef HAVE_BSD_STDLIB_H
+
+/* Define to 1 if you have `arc4random' */
+#undef HAVE_ARC4RANDOM
+
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
#undef HAVE_DOPRNT
/* Has atomic builtins */
#undef HAVE_ATOMIC_BUILTINS
@@ -139,10 +148,13 @@
#undef HAVE_VSNPRINTF
/* Define to 1 if you have the `vsyslog' function. */
#undef HAVE_VSYSLOG
+/* Define if you have the `getrandom' function. */
+#undef HAVE_GETRANDOM
+
/* Define if you have the `getrusage' function. */
#undef HAVE_GETRUSAGE
/* Have __thread */
#undef HAVE___THREAD
diff --git a/comm/third_party/json-c/debug.h b/third_party/json-c/deb/commug.h
--- a/comm/third_party/json-c/debug.h
+++ b/comm/third_party/json-c/debug.h
@@ -12,21 +12,21 @@
/**
* @file
* @brief Do not use, json-c internal, may be changed or removed at any time.
*/
-#ifndef _DEBUG_H_
-#define _DEBUG_H_
+#ifndef _JSON_C_DEBUG_H_
+#define _JSON_C_DEBUG_H_
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef JSON_EXPORT
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && defined(JSON_C_DLL)
#define JSON_EXPORT __declspec(dllexport)
#else
#define JSON_EXPORT extern
#endif
#endif
diff --git a/comm/third_party/json-c/issues_closed_for_0.13.md b/comm/third_party/json-c/issues_closed_for_0.13.md
deleted file mode 100644
--- a/comm/third_party/json-c/issues_closed_for_0.13.md
+++ /dev/null
@@ -1,270 +0,0 @@
-
-This list was created with:
-
-```
-curl https://api.github.com/search/issues?q="repo%3Ajson-c%2Fjson-c+closed%3A>2014-04-10+created%3A<2017-12-01&sort=created&order=asc&per_page=400&page=1" > issues1.out
-curl https://api.github.com/search/issues?q="repo%3Ajson-c%2Fjson-c+closed%3A>2014-04-10+created%3A<2017-12-01&sort=created&order=asc&per_page=400&page=2" > issues2.out
-curl https://api.github.com/search/issues?q="repo%3Ajson-c%2Fjson-c+closed%3A>2014-04-10+created%3A<2017-12-01&sort=created&order=asc&per_page=400&page=3" > issues3.out
-jq -r '.items[] | "[" + .title + "](" + .url + ")" | tostring' issues?.out > issues.md
-sed -e's,^\[ *\(.*\)\](https://api.github.com/.*/\([0-9].*\)),[Issue #\2](https://github.com/json-c/json-c/issues/\2) - \1,' -i issues.md
-#... manual editing ...
-```
-
-----
-
-Issues and Pull Requests closed for the 0.13 release
-(since commit f84d9c, the 0.12 branch point, 2014-04-10)
-
-
-* [Issue #61](https://github.com/json-c/json-c/issues/61) - Make json_object_object_add() indicate success or failure, test fix \
-* [Issue #113](https://github.com/json-c/json-c/issues/113) - Build fixes (make dist and make distcheck) \
-* [Issue #124](https://github.com/json-c/json-c/issues/124) - Fixing build \
-* [Issue #125](https://github.com/json-c/json-c/issues/125) - Fix compile error(variable size set but not used) on g++4.6 \
-* [Issue #126](https://github.com/json-c/json-c/issues/126) - Removed unused size variable. \
-* [Issue #127](https://github.com/json-c/json-c/issues/127) - remove unused `size` variable \
-* [Issue #128](https://github.com/json-c/json-c/issues/128) - Remove unused variable from json_tokenizer.c \
-* [Issue #130](https://github.com/json-c/json-c/issues/130) - Failed to compile under Ubuntu 13.10 32bit \
-* [Issue #131](https://github.com/json-c/json-c/issues/131) - undefined symbol: __sync_val_compare_and_swap_4 \
-* [Issue #132](https://github.com/json-c/json-c/issues/132) - Remove unused variable 'size' \
-* [Issue #133](https://github.com/json-c/json-c/issues/133) - Update and rename README to README.md \
-* [Issue #134](https://github.com/json-c/json-c/issues/134) - Must remove variable size... \
-* [Issue #135](https://github.com/json-c/json-c/issues/135) - bits.h uses removed json_tokener_errors\[error\] \
-* [Issue #136](https://github.com/json-c/json-c/issues/136) - Error when running make check \
-* [Issue #137](https://github.com/json-c/json-c/issues/137) - config.h.in should not be in git \
-* [Issue #138](https://github.com/json-c/json-c/issues/138) - Can't build on RHEL 6.5 due to dependency on automake-1.14 \
-* [Issue #140](https://github.com/json-c/json-c/issues/140) - Code bug in random_test.c evaluating same expression twice \
-* [Issue #141](https://github.com/json-c/json-c/issues/141) - Removed duplicate check in random_seed test - bug #140 \
-* [Issue #142](https://github.com/json-c/json-c/issues/142) - Please undeprecate json_object_object_get \
-* [Issue #144](https://github.com/json-c/json-c/issues/144) - Introduce json_object_from_fd \
-* [Issue #145](https://github.com/json-c/json-c/issues/145) - Handle % character properly \
-* [Issue #146](https://github.com/json-c/json-c/issues/146) - TAGS rename \
-* [Issue #148](https://github.com/json-c/json-c/issues/148) - Bump the soname \
-* [Issue #149](https://github.com/json-c/json-c/issues/149) - SONAME bump \
-* [Issue #150](https://github.com/json-c/json-c/issues/150) - Fix build using MinGW. \
-* [Issue #151](https://github.com/json-c/json-c/issues/151) - Remove json_type enum trailing comma \
-* [Issue #152](https://github.com/json-c/json-c/issues/152) - error while compiling json-c library version 0.11 \
-* [Issue #153](https://github.com/json-c/json-c/issues/153) - improve doc for json_object_to_json_string() \
-* [Issue #154](https://github.com/json-c/json-c/issues/154) - double precision \
-* [Issue #155](https://github.com/json-c/json-c/issues/155) - add bsearch for arrays \
-* [Issue #156](https://github.com/json-c/json-c/issues/156) - Remove trailing whitespaces \
-* [Issue #157](https://github.com/json-c/json-c/issues/157) - JSON-C shall not exit on calloc fail. \
-* [Issue #158](https://github.com/json-c/json-c/issues/158) - while using json-c 0.11, I am facing strange crash issue in json_object_put. \
-* [Issue #159](https://github.com/json-c/json-c/issues/159) - json_tokener.c compile error \
-* [Issue #160](https://github.com/json-c/json-c/issues/160) - missing header file on windows?? \
-* [Issue #161](https://github.com/json-c/json-c/issues/161) - Is there a way to append to file? \
-* [Issue #162](https://github.com/json-c/json-c/issues/162) - json_util: add directory check for POSIX distros \
-* [Issue #163](https://github.com/json-c/json-c/issues/163) - Fix Win32 build problems \
-* [Issue #164](https://github.com/json-c/json-c/issues/164) - made it compile and link on Widnows (as static library) \
-* [Issue #165](https://github.com/json-c/json-c/issues/165) - json_object_to_json_string_ext length \
-* [Issue #167](https://github.com/json-c/json-c/issues/167) - Can't build on Windows with Visual Studio 2010 \
-* [Issue #168](https://github.com/json-c/json-c/issues/168) - Tightening the number parsing algorithm \
-* [Issue #169](https://github.com/json-c/json-c/issues/169) - Doesn't compile on ubuntu 14.04, 64bit \
-* [Issue #170](https://github.com/json-c/json-c/issues/170) - Generated files in repository \
-* [Issue #171](https://github.com/json-c/json-c/issues/171) - Update configuration for VS2010 and win64 \
-* [Issue #172](https://github.com/json-c/json-c/issues/172) - Adding support for parsing octal numbers \
-* [Issue #173](https://github.com/json-c/json-c/issues/173) - json_parse_int64 doesn't work correctly at illumos \
-* [Issue #174](https://github.com/json-c/json-c/issues/174) - Adding JSON_C_TO_STRING_PRETTY_TAB flag \
-* [Issue #175](https://github.com/json-c/json-c/issues/175) - make check fails 4 tests with overflows when built with ASAN \
-* [Issue #176](https://github.com/json-c/json-c/issues/176) - Possible to delete an array element at a given idx ? \
-* [Issue #177](https://github.com/json-c/json-c/issues/177) - Fix compiler warnings \
-* [Issue #178](https://github.com/json-c/json-c/issues/178) - Unable to compile on CentOS5 \
-* [Issue #179](https://github.com/json-c/json-c/issues/179) - Added array_list_del_idx and json_object_array_del_idx \
-* [Issue #180](https://github.com/json-c/json-c/issues/180) - Enable silent build by default \
-* [Issue #181](https://github.com/json-c/json-c/issues/181) - json_tokener_parse_ex accepts invalid JSON \
-* [Issue #182](https://github.com/json-c/json-c/issues/182) - Link against libm when needed \
-* [Issue #183](https://github.com/json-c/json-c/issues/183) - Apply compile warning fix to master branch \
-* [Issue #184](https://github.com/json-c/json-c/issues/184) - Use only GCC-specific flags when compiling with GCC \
-* [Issue #185](https://github.com/json-c/json-c/issues/185) - compile error \
-* [Issue #186](https://github.com/json-c/json-c/issues/186) - Syntax error \
-* [Issue #187](https://github.com/json-c/json-c/issues/187) - array_list_get_idx and negative indexes. \
-* [Issue #188](https://github.com/json-c/json-c/issues/188) - json_object_object_foreach warnings \
-* [Issue #189](https://github.com/json-c/json-c/issues/189) - noisy json_object_from_file: error opening file \
-* [Issue #190](https://github.com/json-c/json-c/issues/190) - warning: initialization discards const qualifier from pointer target type \[enabled by default\] \
-* [Issue #192](https://github.com/json-c/json-c/issues/192) - json_tokener_parse accepts invalid JSON {"key": "value" , } \
-* [Issue #193](https://github.com/json-c/json-c/issues/193) - Make serialization format of doubles configurable \
-* [Issue #194](https://github.com/json-c/json-c/issues/194) - Add utility function for comparing json_objects \
-* [Issue #195](https://github.com/json-c/json-c/issues/195) - Call uselocale instead of setlocale \
-* [Issue #196](https://github.com/json-c/json-c/issues/196) - Performance improvements \
-* [Issue #197](https://github.com/json-c/json-c/issues/197) - Time for a new release? \
-* [Issue #198](https://github.com/json-c/json-c/issues/198) - Fix possible memory leak and remove superfluous NULL checks before free() \
-* [Issue #199](https://github.com/json-c/json-c/issues/199) - Fix build in Visual Studio \
-* [Issue #200](https://github.com/json-c/json-c/issues/200) - Add build scripts for CI platforms \
-* [Issue #201](https://github.com/json-c/json-c/issues/201) - disable forward-slash escaping? \
-* [Issue #202](https://github.com/json-c/json-c/issues/202) - Array with objects support \
-* [Issue #203](https://github.com/json-c/json-c/issues/203) - Add source position/coordinates to API \
-* [Issue #204](https://github.com/json-c/json-c/issues/204) - json-c/json.h not found \
-* [Issue #205](https://github.com/json-c/json-c/issues/205) - json-c Compiled with Visual Studios \
-* [Issue #206](https://github.com/json-c/json-c/issues/206) - what do i use in place of json_object_object_get? \
-* [Issue #207](https://github.com/json-c/json-c/issues/207) - Add support for property pairs directly added to arrays \
-* [Issue #208](https://github.com/json-c/json-c/issues/208) - Performance enhancements (mainly) to json_object_to_json_string() \
-* [Issue #209](https://github.com/json-c/json-c/issues/209) - fix regression from 2d549662be832da838aa063da2efa78ee3b99668 \
-* [Issue #210](https://github.com/json-c/json-c/issues/210) - Use size_t for arrays \
-* [Issue #211](https://github.com/json-c/json-c/issues/211) - Atomic updates for the refcount \
-* [Issue #212](https://github.com/json-c/json-c/issues/212) - Refcount doesn't work between threads \
-* [Issue #213](https://github.com/json-c/json-c/issues/213) - fix to compile with microsoft visual c++ 2010 \
-* [Issue #214](https://github.com/json-c/json-c/issues/214) - Some non-GNU systems support __sync_val_compare_and_swap \
-* [Issue #215](https://github.com/json-c/json-c/issues/215) - Build json-c for window 64 bit. \
-* [Issue #216](https://github.com/json-c/json-c/issues/216) - configure: check realloc with AC_CHECK_FUNCS() to fix cross-compilation. \
-* [Issue #217](https://github.com/json-c/json-c/issues/217) - Checking for functions in float.h \
-* [Issue #218](https://github.com/json-c/json-c/issues/218) - Use a macro to indicate C99 to the compiler \
-* [Issue #219](https://github.com/json-c/json-c/issues/219) - Fix various potential null ptr deref and int32 overflows \
-* [Issue #220](https://github.com/json-c/json-c/issues/220) - Add utility function for comparing json_objects \
-* [Issue #221](https://github.com/json-c/json-c/issues/221) - JSON_C_TO_STRING_NOSLASHESCAPE works incorrectly \
-* [Issue #222](https://github.com/json-c/json-c/issues/222) - Fix issue #221: JSON_C_TO_STRING_NOSLASHESCAPE works incorrectly \
-* [Issue #223](https://github.com/json-c/json-c/issues/223) - Clarify json_object_get_string documentation of NULL handling & return \
-* [Issue #224](https://github.com/json-c/json-c/issues/224) - json_tokener.c - all warnings being treated as errors \
-* [Issue #225](https://github.com/json-c/json-c/issues/225) - Hi, will you support clib as a "registry"? \
-* [Issue #227](https://github.com/json-c/json-c/issues/227) - Bump SOVERSION to 3 \
-* [Issue #228](https://github.com/json-c/json-c/issues/228) - avoid double slashes from json \
-* [Issue #229](https://github.com/json-c/json-c/issues/229) - configure fails: checking size of size_t... configure: error: cannot determine a size for size_t \
-* [Issue #230](https://github.com/json-c/json-c/issues/230) - Use stdint.h to check for size_t size \
-* [Issue #231](https://github.com/json-c/json-c/issues/231) - Fix size_t size check for first-time builds \
-* [Issue #232](https://github.com/json-c/json-c/issues/232) - tests/tests1: fix printf format for size_t arguments \
-* [Issue #233](https://github.com/json-c/json-c/issues/233) - Include stddef.h in json_object.h \
-* [Issue #234](https://github.com/json-c/json-c/issues/234) - Add public API to use userdata independently of custom serializer \
-* [Issue #235](https://github.com/json-c/json-c/issues/235) - Undefined symbols Error for architecture x86_64 on Mac \
-* [Issue #236](https://github.com/json-c/json-c/issues/236) - Building a project which uses json-c with flag -Wcast-qual causes compilation errors \
-* [Issue #237](https://github.com/json-c/json-c/issues/237) - handle escaped utf-8 \
-* [Issue #238](https://github.com/json-c/json-c/issues/238) - linkhash.c: optimised the table_free path \
-* [Issue #239](https://github.com/json-c/json-c/issues/239) - initialize null terminator of new printbuf \
-* [Issue #240](https://github.com/json-c/json-c/issues/240) - Compile error: Variable set but not used \
-* [Issue #241](https://github.com/json-c/json-c/issues/241) - getting error in date string 19\/07\/2016, fixed for error 19/07/2016 \
-* [Issue #242](https://github.com/json-c/json-c/issues/242) - json_tokener_parse error \
-* [Issue #243](https://github.com/json-c/json-c/issues/243) - Fix #165 \
-* [Issue #244](https://github.com/json-c/json-c/issues/244) - Error while compiling source from RHEL5, could you please help me to fix this \
-* [Issue #245](https://github.com/json-c/json-c/issues/245) - json-c compile in window xp \
-* [Issue #246](https://github.com/json-c/json-c/issues/246) - Mac: uselocale failed to build \
-* [Issue #247](https://github.com/json-c/json-c/issues/247) - json_object_array_del_idx function has segment fault error? \
-* [Issue #248](https://github.com/json-c/json-c/issues/248) - Minor changes in C source code \
-* [Issue #249](https://github.com/json-c/json-c/issues/249) - Improving README \
-* [Issue #250](https://github.com/json-c/json-c/issues/250) - Improving .gitignore \
-* [Issue #251](https://github.com/json-c/json-c/issues/251) - Adding a file for EditorConfig \
-* [Issue #252](https://github.com/json-c/json-c/issues/252) - Very minor changes not related to C source code \
-* [Issue #253](https://github.com/json-c/json-c/issues/253) - Adding a test with cppcheck for Travis CI \
-* [Issue #254](https://github.com/json-c/json-c/issues/254) - Very minor changes to some tests \
-* [Issue #255](https://github.com/json-c/json-c/issues/255) - Minor changes in C source code \
-* [Issue #256](https://github.com/json-c/json-c/issues/256) - Mailing list dead? \
-* [Issue #257](https://github.com/json-c/json-c/issues/257) - Defining a coding style \
-* [Issue #258](https://github.com/json-c/json-c/issues/258) - Enable CI services \
-* [Issue #259](https://github.com/json-c/json-c/issues/259) - Fails to parse valid json \
-* [Issue #260](https://github.com/json-c/json-c/issues/260) - Adding an object to itself \
-* [Issue #261](https://github.com/json-c/json-c/issues/261) - Lack of proper documentation \
-* [Issue #262](https://github.com/json-c/json-c/issues/262) - Add Cmakefile and fix compiler warning. \
-* [Issue #263](https://github.com/json-c/json-c/issues/263) - Compiler Warnings with VS2015 \
-* [Issue #264](https://github.com/json-c/json-c/issues/264) - successed in simple test while failed in my project \
-* [Issue #265](https://github.com/json-c/json-c/issues/265) - Conformance report for reference \
-* [Issue #266](https://github.com/json-c/json-c/issues/266) - crash perhaps related to reference counting \
-* [Issue #267](https://github.com/json-c/json-c/issues/267) - Removes me as Win32 maintainer, because I'm not. \
-* [Issue #268](https://github.com/json-c/json-c/issues/268) - Documentation of json_object_to_json_string gives no information about memory management \
-* [Issue #269](https://github.com/json-c/json-c/issues/269) - json_object_<type>_set(json_object *o,<type> value) API for value setting in json object private structure \
-* [Issue #270](https://github.com/json-c/json-c/issues/270) - new API json_object_new_double_f(doubel d,const char * fmt); \
-* [Issue #271](https://github.com/json-c/json-c/issues/271) - Cannot compile using CMake on macOS \
-* [Issue #273](https://github.com/json-c/json-c/issues/273) - fixed wrong object name in json_object_all_values_equal \
-* [Issue #274](https://github.com/json-c/json-c/issues/274) - Support for 64 bit pointers on Windows \
-* [Issue #275](https://github.com/json-c/json-c/issues/275) - Out-of-bounds read in json_tokener_parse_ex \
-* [Issue #276](https://github.com/json-c/json-c/issues/276) - ./configure for centos release 6.7(final) failure \
-* [Issue #277](https://github.com/json-c/json-c/issues/277) - Json object set xxx \
-* [Issue #278](https://github.com/json-c/json-c/issues/278) - Serialization of double with no fractional component drops trailing zero \
-* [Issue #279](https://github.com/json-c/json-c/issues/279) - Segmentation fault in array_list_length() \
-* [Issue #280](https://github.com/json-c/json-c/issues/280) - Should json_object_array_get_idx check whether input obj is array? \
-* [Issue #281](https://github.com/json-c/json-c/issues/281) - how to pretty print json-c? \
-* [Issue #282](https://github.com/json-c/json-c/issues/282) - ignore temporary files \
-* [Issue #283](https://github.com/json-c/json-c/issues/283) - json_pointer: add first revision based on RFC 6901 \
-* [Issue #284](https://github.com/json-c/json-c/issues/284) - Resusing json_tokener object \
-* [Issue #285](https://github.com/json-c/json-c/issues/285) - Revert "compat/strdup.h: move common compat check for strdup() to own \
-* [Issue #286](https://github.com/json-c/json-c/issues/286) - json_tokener_parse_ex() returns json_tokener_continue on zero-length string \
-* [Issue #287](https://github.com/json-c/json-c/issues/287) - json_pointer: extend setter & getter with printf() style arguments \
-* [Issue #288](https://github.com/json-c/json-c/issues/288) - Fix _GNU_SOURCE define for vasprintf \
-* [Issue #289](https://github.com/json-c/json-c/issues/289) - bugfix: floating point representaion without fractional part \
-* [Issue #290](https://github.com/json-c/json-c/issues/290) - duplicate an json_object \
-* [Issue #291](https://github.com/json-c/json-c/issues/291) - isspace assert error \
-* [Issue #292](https://github.com/json-c/json-c/issues/292) - configure error "./configure: line 13121: syntax error near unexpected token `-Wall'" \
-* [Issue #293](https://github.com/json-c/json-c/issues/293) - how to make with bitcode for ios \
-* [Issue #294](https://github.com/json-c/json-c/issues/294) - Adding UTF-8 validation. Fixes #122 \
-* [Issue #295](https://github.com/json-c/json-c/issues/295) - cross compile w/ mingw \
-* [Issue #296](https://github.com/json-c/json-c/issues/296) - Missing functions header in json_object.h \
-* [Issue #297](https://github.com/json-c/json-c/issues/297) - could not parse string to Json object? Like string str=\"helloworld;E\\test\\log\\;end\" \
-* [Issue #298](https://github.com/json-c/json-c/issues/298) - Building using CMake doesn't work \
-* [Issue #299](https://github.com/json-c/json-c/issues/299) - Improve json_object -> string performance \
-* [Issue #300](https://github.com/json-c/json-c/issues/300) - Running tests with MinGW build \
-* [Issue #301](https://github.com/json-c/json-c/issues/301) - How to deep copy json_object in C++ ? \
-* [Issue #302](https://github.com/json-c/json-c/issues/302) - json_tokener_parse_ex doesn't parse JSON values \
-* [Issue #303](https://github.com/json-c/json-c/issues/303) - fix doc in tokener header file \
-* [Issue #304](https://github.com/json-c/json-c/issues/304) - (.text+0x72846): undefined reference to `is_error' \
-* [Issue #305](https://github.com/json-c/json-c/issues/305) - Fix compilation without C-99 option \
-* [Issue #306](https://github.com/json-c/json-c/issues/306) - ./configure: line 12748 -error=deprecated-declarations \
-* [Issue #307](https://github.com/json-c/json-c/issues/307) - Memory leak in json_tokener_parse \
-* [Issue #308](https://github.com/json-c/json-c/issues/308) - AM_PROG_LIBTOOL not found on Linux \
-* [Issue #309](https://github.com/json-c/json-c/issues/309) - GCC 7 reports various -Wimplicit-fallthrough= errors \
-* [Issue #310](https://github.com/json-c/json-c/issues/310) - Add FALLTHRU comment to handle GCC7 warnings. \
-* [Issue #311](https://github.com/json-c/json-c/issues/311) - Fix error C3688 when compiling on Visual Studio 2015 \
-* [Issue #312](https://github.com/json-c/json-c/issues/312) - Fix CMake Build process improved for MinGW and MSYS2 \
-* [Issue #313](https://github.com/json-c/json-c/issues/313) - VERBOSE=1 make check; tests/test_util_file.test.c and tests/test_util_file.expected out of sync \
-* [Issue #315](https://github.com/json-c/json-c/issues/315) - Passing -1 to json_tokener_parse_ex is possibly unsafe \
-* [Issue #316](https://github.com/json-c/json-c/issues/316) - Memory Returned by json_object_to_json_string not freed \
-* [Issue #317](https://github.com/json-c/json-c/issues/317) - json_object_get_string gives segmentation error \
-* [Issue #318](https://github.com/json-c/json-c/issues/318) - PVS-Studio static analyzer analyze results \
-* [Issue #319](https://github.com/json-c/json-c/issues/319) - Windows: Fix dynamic library build with Visual Studio \
-* [Issue #320](https://github.com/json-c/json-c/issues/320) - Can't compile in Mac OS X El Capitan \
-* [Issue #321](https://github.com/json-c/json-c/issues/321) - build,cmake: fix vasprintf implicit definition and generate both static & shared libs \
-* [Issue #322](https://github.com/json-c/json-c/issues/322) - can not link with libjson-c.a \
-* [Issue #323](https://github.com/json-c/json-c/issues/323) - implicit fallthrough detected by gcc 7.1 \
-* [Issue #324](https://github.com/json-c/json-c/issues/324) - JsonPath like function? \
-* [Issue #325](https://github.com/json-c/json-c/issues/325) - Fix stack buffer overflow in json_object_double_to_json_string_format() \
-* [Issue #327](https://github.com/json-c/json-c/issues/327) - why json-c so hard to compile \
-* [Issue #328](https://github.com/json-c/json-c/issues/328) - json_object: implement json_object_deep_copy() function \
-* [Issue #329](https://github.com/json-c/json-c/issues/329) - build,cmake: build,cmake: rename libjson-c-static.a to libjson-c.a \
-* [Issue #330](https://github.com/json-c/json-c/issues/330) - tests: symlink basic tests to a single file that has the common code \
-* [Issue #331](https://github.com/json-c/json-c/issues/331) - Safe use of snprintf() / vsnprintf() for Visual studio, and thread-safety fix \
-* [Issue #332](https://github.com/json-c/json-c/issues/332) - Valgrind: invalid read after json_object_array_del_idx. \
-* [Issue #333](https://github.com/json-c/json-c/issues/333) - Replace obsolete AM_PROG_LIBTOOL \
-* [Issue #335](https://github.com/json-c/json-c/issues/335) - README.md: show build status tag from travis-ci.org \
-* [Issue #336](https://github.com/json-c/json-c/issues/336) - tests: fix tests in travis-ci.org \
-* [Issue #337](https://github.com/json-c/json-c/issues/337) - Synchronize "potentially racy" random seed in lh_char_hash() \
-* [Issue #338](https://github.com/json-c/json-c/issues/338) - implement json_object_int_inc(json_object *, int64_t) \
-* [Issue #339](https://github.com/json-c/json-c/issues/339) - Json schema validation \
-* [Issue #340](https://github.com/json-c/json-c/issues/340) - strerror_override: add extern "C" and JSON_EXPORT specifiers for Visual C++ compilers \
-* [Issue #341](https://github.com/json-c/json-c/issues/341) - character "/" parse as "\/" \
-* [Issue #342](https://github.com/json-c/json-c/issues/342) - No such file or directory "/usr/include/json.h" \
-* [Issue #343](https://github.com/json-c/json-c/issues/343) - Can't parse json \
-* [Issue #344](https://github.com/json-c/json-c/issues/344) - Fix Mingw build \
-* [Issue #345](https://github.com/json-c/json-c/issues/345) - Fix make dist and make distcheck \
-* [Issue #346](https://github.com/json-c/json-c/issues/346) - Clamp double to int32 when narrowing in json_object_get_int. \
-* [Issue #347](https://github.com/json-c/json-c/issues/347) - MSVC linker error json_c_strerror \
-* [Issue #348](https://github.com/json-c/json-c/issues/348) - why \
-* [Issue #349](https://github.com/json-c/json-c/issues/349) - `missing` is missing? \
-* [Issue #350](https://github.com/json-c/json-c/issues/350) - stderror-override and disable-shared \
-* [Issue #351](https://github.com/json-c/json-c/issues/351) - SIZE_T_MAX redefined from limits.h \
-* [Issue #352](https://github.com/json-c/json-c/issues/352) - `INSTALL` overrides an automake script. \
-* [Issue #353](https://github.com/json-c/json-c/issues/353) - Documentation issues \
-* [Issue #354](https://github.com/json-c/json-c/issues/354) - Fixes #351 #352 #353 \
-* [Issue #355](https://github.com/json-c/json-c/issues/355) - 1.make it can been compiled with Visual Studio 2010 by modify the CMakeList.txt and others \
-* [Issue #356](https://github.com/json-c/json-c/issues/356) - VS2008 test test_util_file.cpp err! \
-* [Issue #357](https://github.com/json-c/json-c/issues/357) - __json_c_strerror incompatibility with link-time optimization \
-* [Issue #358](https://github.com/json-c/json-c/issues/358) - make issue \
-* [Issue #359](https://github.com/json-c/json-c/issues/359) - update CMakeLists.txt for compile with visual studio at least 2010 \
-* [Issue #360](https://github.com/json-c/json-c/issues/360) - Use strtoll() to parse ints \
-* [Issue #361](https://github.com/json-c/json-c/issues/361) - Fix double to int cast overflow in json_object_get_int64. \
-* [Issue #362](https://github.com/json-c/json-c/issues/362) - CMake Package Config \
-* [Issue #363](https://github.com/json-c/json-c/issues/363) - Issue #338, add json_object_add_int functions \
-* [Issue #364](https://github.com/json-c/json-c/issues/364) - Cmake is Errir \
-* [Issue #365](https://github.com/json-c/json-c/issues/365) - added fallthrough for gcc7 \
-* [Issue #366](https://github.com/json-c/json-c/issues/366) - how to check the json string,crash! \
-* [Issue #367](https://github.com/json-c/json-c/issues/367) - Is json-c support "redirect" semantic? \
-* [Issue #368](https://github.com/json-c/json-c/issues/368) - Add examples \
-* [Issue #369](https://github.com/json-c/json-c/issues/369) - How to build json-c library for android? \
-* [Issue #370](https://github.com/json-c/json-c/issues/370) - Compiling using clang-cl \
-* [Issue #371](https://github.com/json-c/json-c/issues/371) - Invalid parsing for Infinity with json-c 0.12 \
-* [Issue #372](https://github.com/json-c/json-c/issues/372) - Json-c 0.12: Fixed Infinity bug \
-* [Issue #373](https://github.com/json-c/json-c/issues/373) - build: fix build on appveyor CI \
-* [Issue #374](https://github.com/json-c/json-c/issues/374) - Undefined symbols for architecture x86_64: \
-* [Issue #375](https://github.com/json-c/json-c/issues/375) - what would happened when json_object_object_add add the same key \
-* [Issue #376](https://github.com/json-c/json-c/issues/376) - Eclipse error \
-* [Issue #377](https://github.com/json-c/json-c/issues/377) - on gcc 7.2.0 on my linux distribution with json-c 2013-04-02 source \
-* [Issue #378](https://github.com/json-c/json-c/issues/378) - Eclipse: library (libjson-c) not found, but configured \
-* [Issue #379](https://github.com/json-c/json-c/issues/379) - error: this statement may fall through \[-Werror=implicit-fallthrough=\] \
-* [Issue #380](https://github.com/json-c/json-c/issues/380) - Build on Windows \
-* [Issue #381](https://github.com/json-c/json-c/issues/381) - Fix makedist \
-* [Issue #382](https://github.com/json-c/json-c/issues/382) - Memory leak for json_tokener_parse_ex for version 0.12.1 \
-* [Issue #383](https://github.com/json-c/json-c/issues/383) - Fix a compiler warning. \
-* [Issue #384](https://github.com/json-c/json-c/issues/384) - Fix a VS 2015 compiler warnings. \
diff --git a/comm/third_party/json-c/issues_closed_for_0.14.md b/comm/third_party/json-c/issues_closed_for_0.14.md
deleted file mode 100644
--- a/comm/third_party/json-c/issues_closed_for_0.14.md
+++ /dev/null
@@ -1,202 +0,0 @@
-This list was created with:
-
-```
-curl https://api.github.com/search/issues?q="repo%3Ajson-c%2Fjson-c+closed%3A>2017-12-07+created%3A<2020-04-17&sort=created&order=asc&per_page=400&page=1" > issues1.out
-curl https://api.github.com/search/issues?q="repo%3Ajson-c%2Fjson-c+closed%3A>2017-12-07+created%3A<2020-04-17&sort=created&order=asc&per_page=400&page=2" > issues2.out
-curl https://api.github.com/search/issues?q="repo%3Ajson-c%2Fjson-c+closed%3A>2017-12-07+created%3A<2020-04-17&sort=created&order=asc&per_page=400&page=3" > issues3.out
-jq -r '.items[] | "[" + .title + "](" + .url + ")" | tostring' issues?.out > issues.md
-sed -e's,^\[ *\(.*\)\](https://api.github.com/.*/\([0-9].*\)),[Issue #\2](https://github.com/json-c/json-c/issues/\2) - \1,' -i issues.md
-#... manual editing ...
-```
-
-----
-
-Issues and Pull Requests closed for the 0.14 release (since commit d582d3a(2017-12-07) to a911439(2020-04-17))
-
-
-* [Issue #122](https://github.com/json-c/json-c/issues/122) - Add utf-8 validation when parsing strings. \
-* [Issue #139](https://github.com/json-c/json-c/issues/139) - json_object_from_file cannot accept max_depth \
-* [Issue #143](https://github.com/json-c/json-c/issues/143) - RFE / enhancement for full 64-bit signed/unsigned support \
-* [Issue #147](https://github.com/json-c/json-c/issues/147) - Please introduce soname bump if API changed \
-* [Issue #166](https://github.com/json-c/json-c/issues/166) - Need a way to specify nesting depth when opening JSON file \
-* [Issue #226](https://github.com/json-c/json-c/issues/226) - There is no json_object_new_null() \
-* [Issue #314](https://github.com/json-c/json-c/issues/314) - new release ? \
-* [Issue #326](https://github.com/json-c/json-c/issues/326) - Please extend api json_object_get_uint64 \
-* [Issue #334](https://github.com/json-c/json-c/issues/334) - Switch json-c builds to use CMake \
-* [Issue #386](https://github.com/json-c/json-c/issues/386) - Makefile: Add ACLOCAL_AMFLAGS \
-* [Issue #387](https://github.com/json-c/json-c/issues/387) - doc: Use other doxygen feature to specify mainpage \
-* [Issue #388](https://github.com/json-c/json-c/issues/388) - json_object: Add size_t json_object_sizeof() \
-* [Issue #389](https://github.com/json-c/json-c/issues/389) - json_object: Avoid double free (and thus a segfault) when ref_count gets < 0 \
-* [Issue #390](https://github.com/json-c/json-c/issues/390) - json_object: Add const size_t json_c_object_sizeof() \
-* [Issue #391](https://github.com/json-c/json-c/issues/391) - Fix non-GNUC define for JSON_C_CONST_FUNCTION \
-* [Issue #392](https://github.com/json-c/json-c/issues/392) - json_object: Avoid invalid free (and thus a segfault) when ref_count gets < 0 \
-* [Issue #393](https://github.com/json-c/json-c/issues/393) - json_object_private: Use unsigned 32-bit integer type for refcount \
-* [Issue #394](https://github.com/json-c/json-c/issues/394) - Problem serializing double \
-* [Issue #395](https://github.com/json-c/json-c/issues/395) - Key gets modified if it contains "\" \
-* [Issue #396](https://github.com/json-c/json-c/issues/396) - Build failure with no threads uClibc toolchain \
-* [Issue #397](https://github.com/json-c/json-c/issues/397) - update json object with key. \
-* [Issue #398](https://github.com/json-c/json-c/issues/398) - Build failed. \
-* [Issue #399](https://github.com/json-c/json-c/issues/399) - Avoid uninitialized variable warnings \
-* [Issue #400](https://github.com/json-c/json-c/issues/400) - How to generate static lib (.a) \
-* [Issue #401](https://github.com/json-c/json-c/issues/401) - Warnings with Valgrind \
-* [Issue #402](https://github.com/json-c/json-c/issues/402) - Add fuzzers from OSS-Fuzz \
-* [Issue #403](https://github.com/json-c/json-c/issues/403) - Segmentation fault when double quotes is used \
-* [Issue #404](https://github.com/json-c/json-c/issues/404) - valgrind: memory leak \
-* [Issue #405](https://github.com/json-c/json-c/issues/405) - Missing API to determine an object is empty \
-* [Issue #406](https://github.com/json-c/json-c/issues/406) - Undefine NDEBUG for tests \
-* [Issue #407](https://github.com/json-c/json-c/issues/407) - json_tokener_parse is crash \
-* [Issue #408](https://github.com/json-c/json-c/issues/408) - bug in array_list_del_idx when array_list_length()==1 \
-* [Issue #410](https://github.com/json-c/json-c/issues/410) - Fixed typos \
-* [Issue #411](https://github.com/json-c/json-c/issues/411) - Crash- signal SIGSEGV, Segmentation fault. ../sysdeps/x86_64/strlen.S: No such file or directory. \
-* [Issue #412](https://github.com/json-c/json-c/issues/412) - json_type changes during inter process communication. \
-* [Issue #413](https://github.com/json-c/json-c/issues/413) - how to read object of type `json_object *` in c++ \
-* [Issue #414](https://github.com/json-c/json-c/issues/414) - [Question] How JSON-c stores the serialized data in memory? \
-* [Issue #415](https://github.com/json-c/json-c/issues/415) - Resolve windows name conflict \
-* [Issue #416](https://github.com/json-c/json-c/issues/416) - segmentation fault in json_tokener_parse \
-* [Issue #417](https://github.com/json-c/json-c/issues/417) - json_tokener_parse json_object_object_get_ex with string value which is json string \
-* [Issue #418](https://github.com/json-c/json-c/issues/418) - json_object_from_* return value documented incorrectly \
-* [Issue #419](https://github.com/json-c/json-c/issues/419) - Suggestion: document (and define) that json_object_put() accepts NULL pointer to object \
-* [Issue #420](https://github.com/json-c/json-c/issues/420) - arraylist: Fixed names of parameters for callback function \
-* [Issue #421](https://github.com/json-c/json-c/issues/421) - install json_object_iterator.h header file \
-* [Issue #422](https://github.com/json-c/json-c/issues/422) - json_object_get_double() does not set errno when there is no valid conversion \
-* [Issue #423](https://github.com/json-c/json-c/issues/423) - memory leak \
-* [Issue #424](https://github.com/json-c/json-c/issues/424) - Parse string contains "\" or "/" errors \
-* [Issue #425](https://github.com/json-c/json-c/issues/425) - what this is? \
-* [Issue #426](https://github.com/json-c/json-c/issues/426) - __deprecated not supported on clang. \
-* [Issue #427](https://github.com/json-c/json-c/issues/427) - CMake: builds involving this target will not be correct \
-* [Issue #430](https://github.com/json-c/json-c/issues/430) - json_object_object_del() and Segmentation fault \
-* [Issue #431](https://github.com/json-c/json-c/issues/431) - cmake: Bump required version \
-* [Issue #432](https://github.com/json-c/json-c/issues/432) - The real CMake support. \
-* [Issue #433](https://github.com/json-c/json-c/issues/433) - The real CMake support. \
-* [Issue #434](https://github.com/json-c/json-c/issues/434) - The real CMake support \
-* [Issue #435](https://github.com/json-c/json-c/issues/435) - json_object_object_del() segmentation fault \
-* [Issue #436](https://github.com/json-c/json-c/issues/436) - Improve pkgconfig setting \
-* [Issue #437](https://github.com/json-c/json-c/issues/437) - Bad link in README.md \
-* [Issue #438](https://github.com/json-c/json-c/issues/438) - Bad link in README.html \
-* [Issue #439](https://github.com/json-c/json-c/issues/439) - reserved identifier violation \
-* [Issue #440](https://github.com/json-c/json-c/issues/440) - Use of angle brackets around file names for include statements \
-* [Issue #441](https://github.com/json-c/json-c/issues/441) - fix c flag loss during cmake building \
-* [Issue #442](https://github.com/json-c/json-c/issues/442) - error in configure file \
-* [Issue #443](https://github.com/json-c/json-c/issues/443) - remove pretty spaces when using pretty tabs \
-* [Issue #444](https://github.com/json-c/json-c/issues/444) - Document refcount of json_tokener_parse_ex return \
-* [Issue #445](https://github.com/json-c/json-c/issues/445) - Add missing "make check" target to cmake config \
-* [Issue #446](https://github.com/json-c/json-c/issues/446) - Forward slashes get escaped \
-* [Issue #448](https://github.com/json-c/json-c/issues/448) - Buffer overflow in json-c \
-* [Issue #449](https://github.com/json-c/json-c/issues/449) - Need of json_type_int64 returned by json_object_get_type() \
-* [Issue #450](https://github.com/json-c/json-c/issues/450) - Allow use json-c cmake as subproject \
-* [Issue #452](https://github.com/json-c/json-c/issues/452) - Update README.md \
-* [Issue #453](https://github.com/json-c/json-c/issues/453) - Fixed misalignment in JSON string due to space after \n being printed... \
-* [Issue #454](https://github.com/json-c/json-c/issues/454) - json_object_private: save 8 bytes in struct json_object in 64-bit arc… \
-* [Issue #455](https://github.com/json-c/json-c/issues/455) - index.html:fix dead link \
-* [Issue #456](https://github.com/json-c/json-c/issues/456) - STYLE.txt:remove executable permissions \
-* [Issue #457](https://github.com/json-c/json-c/issues/457) - .gitignore:add build directory \
-* [Issue #458](https://github.com/json-c/json-c/issues/458) - README.md:fix dead "file.html" link \
-* [Issue #459](https://github.com/json-c/json-c/issues/459) - README.html:fix link to Doxygen docs, remove WIN32 link \
-* [Issue #460](https://github.com/json-c/json-c/issues/460) - No docs for json_object_new_string_len() \
-* [Issue #461](https://github.com/json-c/json-c/issues/461) - json_object.c:set errno in json_object_get_double() \
-* [Issue #462](https://github.com/json-c/json-c/issues/462) - json_object.h:document json_object_new_string_len() \
-* [Issue #463](https://github.com/json-c/json-c/issues/463) - please check newlocale api first argument valuse. \
-* [Issue #465](https://github.com/json-c/json-c/issues/465) - CMakeLists.txt doesn't contain json_object_iterator.h which json.h includes \
-* [Issue #466](https://github.com/json-c/json-c/issues/466) - configure:3610: error: C compiler cannot create executables \
-* [Issue #467](https://github.com/json-c/json-c/issues/467) - Fix compiler warnings \
-* [Issue #468](https://github.com/json-c/json-c/issues/468) - Fix compiler warnings \
-* [Issue #469](https://github.com/json-c/json-c/issues/469) - Build under alpine with pecl install & docker-php-ext-enable? \
-* [Issue #470](https://github.com/json-c/json-c/issues/470) - cfuhash_foreach_remove doesn't upate cfuhash_num_entries \
-* [Issue #472](https://github.com/json-c/json-c/issues/472) - Segmentation fault in json_object_iter_begin \
-* [Issue #473](https://github.com/json-c/json-c/issues/473) - Convert ChangeLog to valid UTF-8 encoding. \
-* [Issue #474](https://github.com/json-c/json-c/issues/474) - Installation directories empty with CMake in pkg-config. \
-* [Issue #475](https://github.com/json-c/json-c/issues/475) - improvement proposal for json_object_object_foreach \
-* [Issue #477](https://github.com/json-c/json-c/issues/477) - Hang/Crash with large strings \
-* [Issue #478](https://github.com/json-c/json-c/issues/478) - json_object_get_string_len returns 0 when value is number \
-* [Issue #479](https://github.com/json-c/json-c/issues/479) - I want to use it in iOS or Android but I can't compile \
-* [Issue #480](https://github.com/json-c/json-c/issues/480) - json-c-0.12.1 failed making from source code \
-* [Issue #481](https://github.com/json-c/json-c/issues/481) - error while loading shared libraries: libjson-c.so.4 \
-* [Issue #482](https://github.com/json-c/json-c/issues/482) - Error "double free or corruption" after free() \
-* [Issue #483](https://github.com/json-c/json-c/issues/483) - compatible with rarely-used Chinese characters in GBK charset \
-* [Issue #485](https://github.com/json-c/json-c/issues/485) - Install CMake module files \
-* [Issue #486](https://github.com/json-c/json-c/issues/486) - In the case of negative double value, it is formatted without including ".0" \
-* [Issue #488](https://github.com/json-c/json-c/issues/488) - Some APIs are not exported when built as shared lib on Win32 \
-* [Issue #489](https://github.com/json-c/json-c/issues/489) - Don't use -Werror by default \
-* [Issue #490](https://github.com/json-c/json-c/issues/490) - do not compile with -Werror by default \
-* [Issue #491](https://github.com/json-c/json-c/issues/491) - build: add option --disable-werror to configure \
-* [Issue #492](https://github.com/json-c/json-c/issues/492) - lack some quick usage in readme \
-* [Issue #494](https://github.com/json-c/json-c/issues/494) - Code generator? \
-* [Issue #495](https://github.com/json-c/json-c/issues/495) - README.md:fix 2 typos \
-* [Issue #496](https://github.com/json-c/json-c/issues/496) - json_pointer.h:suggest minor grammar improvement for pointer doc \
-* [Issue #497](https://github.com/json-c/json-c/issues/497) - add common header for all tests \
-* [Issue #498](https://github.com/json-c/json-c/issues/498) - double_serializer_test fails (with valgrind) \
-* [Issue #499](https://github.com/json-c/json-c/issues/499) - .travis.yml:test on more recent clang and gcc versions \
-* [Issue #500](https://github.com/json-c/json-c/issues/500) - test/Makefile.am:add missing deps for test1 and test2 \
-* [Issue #501](https://github.com/json-c/json-c/issues/501) - undefine NDEBUG for tests \
-* [Issue #502](https://github.com/json-c/json-c/issues/502) - configure error \
-* [Issue #503](https://github.com/json-c/json-c/issues/503) - json-c retuns OK when Invalid json string is passed \
-* [Issue #504](https://github.com/json-c/json-c/issues/504) - json_object_put coredump \
-* [Issue #505](https://github.com/json-c/json-c/issues/505) - Add vcpkg installation instructions \
-* [Issue #506](https://github.com/json-c/json-c/issues/506) - Cannot parse more than one object \
-* [Issue #509](https://github.com/json-c/json-c/issues/509) - Sometimes a double value is not serialized \
-* [Issue #510](https://github.com/json-c/json-c/issues/510) - Bump so-name and improve CMake \
-* [Issue #511](https://github.com/json-c/json-c/issues/511) - Reduce lines for better optimization \
-* [Issue #512](https://github.com/json-c/json-c/issues/512) - Properly append to CMAKE_C_FLAGS string \
-* [Issue #513](https://github.com/json-c/json-c/issues/513) - What does `userdata` means?And what is the case we can use it? \
-* [Issue #514](https://github.com/json-c/json-c/issues/514) - Json c 0.13 \
-* [Issue #515](https://github.com/json-c/json-c/issues/515) - Mies suomesta fixes segfaults and logic errors \
-* [Issue #516](https://github.com/json-c/json-c/issues/516) - Lja slight mods \
-* [Issue #518](https://github.com/json-c/json-c/issues/518) - Escape character "\\003\", get unexpected value \
-* [Issue #519](https://github.com/json-c/json-c/issues/519) - Add test case obj token \
-* [Issue #520](https://github.com/json-c/json-c/issues/520) - Adding type uint64 \
-* [Issue #521](https://github.com/json-c/json-c/issues/521) - build cmake windows 10 \
-* [Issue #522](https://github.com/json-c/json-c/issues/522) - update json_visit testcase \
-* [Issue #523](https://github.com/json-c/json-c/issues/523) - update tsetcase for tokener_c \
-* [Issue #524](https://github.com/json-c/json-c/issues/524) - Increase coverage \
-* [Issue #525](https://github.com/json-c/json-c/issues/525) - update pointer test case \
-* [Issue #526](https://github.com/json-c/json-c/issues/526) - Increased the test coverage of printbuf.c 82% to 92%. \
-* [Issue #527](https://github.com/json-c/json-c/issues/527) - Arraylist testcase \
-* [Issue #528](https://github.com/json-c/json-c/issues/528) - Solve issue #108. Skip \u0000 while parsing. \
-* [Issue #529](https://github.com/json-c/json-c/issues/529) - Increased the test coverage of json_c_version.c 0% to 100%. \
-* [Issue #530](https://github.com/json-c/json-c/issues/530) - validate utf-8 string before parse \
-* [Issue #531](https://github.com/json-c/json-c/issues/531) - validate utf-8 string \
-* [Issue #532](https://github.com/json-c/json-c/issues/532) - json_object_object_get_ex returning the original object \
-* [Issue #533](https://github.com/json-c/json-c/issues/533) - Fix "make check" \
-* [Issue #535](https://github.com/json-c/json-c/issues/535) - short string optimization: excessive array length \
-* [Issue #536](https://github.com/json-c/json-c/issues/536) - add json_object_new_null() \
-* [Issue #538](https://github.com/json-c/json-c/issues/538) - update shortstring and arraylist parameters \
-* [Issue #539](https://github.com/json-c/json-c/issues/539) - double serializes to the old value after set_double \
-* [Issue #541](https://github.com/json-c/json-c/issues/541) - add coveralls auto tool to json-c \
-* [Issue #542](https://github.com/json-c/json-c/issues/542) - add uint64 data to json-c \
-* [Issue #543](https://github.com/json-c/json-c/issues/543) - Readme \
-* [Issue #544](https://github.com/json-c/json-c/issues/544) - Increase distcheck target in cmake \
-* [Issue #545](https://github.com/json-c/json-c/issues/545) - add doc target in cmake \
-* [Issue #546](https://github.com/json-c/json-c/issues/546) - Add uninstall target in cmake \
-* [Issue #547](https://github.com/json-c/json-c/issues/547) - modify json-c default build type, and fix up the assert() errors in t… \
-* [Issue #548](https://github.com/json-c/json-c/issues/548) - Solve some problems about cmake build type (debug/release) \
-* [Issue #549](https://github.com/json-c/json-c/issues/549) - lib installation issues \
-* [Issue #550](https://github.com/json-c/json-c/issues/550) - Format codes with clang-format tool? \
-* [Issue #551](https://github.com/json-c/json-c/issues/551) - Allow hexadecimal number format convention parsing \
-* [Issue #553](https://github.com/json-c/json-c/issues/553) - Fix/clang ubsan \
-* [Issue #554](https://github.com/json-c/json-c/issues/554) - RFC 8259 compatibility mode \
-* [Issue #555](https://github.com/json-c/json-c/issues/555) - Format json-c with clang-format tool \
-* [Issue #556](https://github.com/json-c/json-c/issues/556) - Fixes various Wreturn-type and Wimplicit-fallthrough errors on Mingw-w64 \
-* [Issue #557](https://github.com/json-c/json-c/issues/557) - Add option in CMAKE to not build documentation \
-* [Issue #558](https://github.com/json-c/json-c/issues/558) - modify the doc target message \
-* [Issue #559](https://github.com/json-c/json-c/issues/559) - json_c_visit() not exported on Windows \
-* [Issue #560](https://github.com/json-c/json-c/issues/560) - error: implicit declaration of function '_strtoi64' \
-* [Issue #561](https://github.com/json-c/json-c/issues/561) - add the badge in README.md and test the coveralls \
-* [Issue #562](https://github.com/json-c/json-c/issues/562) - Bugfix and testcases supplements \
-* [Issue #563](https://github.com/json-c/json-c/issues/563) - Changed order of calloc args to match stdlib \
-* [Issue #564](https://github.com/json-c/json-c/issues/564) - Remove autogenerated files \
-* [Issue #565](https://github.com/json-c/json-c/issues/565) - test the CI and ignore this PR \
-* [Issue #566](https://github.com/json-c/json-c/issues/566) - add the json_types.h to Makefile.am \
-* [Issue #567](https://github.com/json-c/json-c/issues/567) - Install json_types.h with autotools build as well. \
-* [Issue #568](https://github.com/json-c/json-c/issues/568) - Adding better support to MinGW \
-* [Issue #569](https://github.com/json-c/json-c/issues/569) - Handling of -Bsymbolic-function in CMakeLists.txt is deficient \
-* [Issue #571](https://github.com/json-c/json-c/issues/571) - CMake: Bump SONAME to 5. \
-* [Issue #572](https://github.com/json-c/json-c/issues/572) - Small fixes to CMakeLists \
-* [Issue #573](https://github.com/json-c/json-c/issues/573) - Fix coveralls submission. \
-* [Issue #574](https://github.com/json-c/json-c/issues/574) - autogen.sh missing from repository \
-* [Issue #575](https://github.com/json-c/json-c/issues/575) - Small cosmetics. \
-* [Issue #576](https://github.com/json-c/json-c/issues/576) - Test coverage for json_c_version. \
-* [Issue #577](https://github.com/json-c/json-c/issues/577) - Be verbose on failing json_c_version test. \
-* [Issue #578](https://github.com/json-c/json-c/issues/578) - CMake: Install pkgconfig file in proper location by default \
-* [Issue #579](https://github.com/json-c/json-c/issues/579) - Enforce strict prototypes. \
-* [Issue #580](https://github.com/json-c/json-c/issues/580) - Fix CMake tests for enforced strict prototypes. \
-* [Issue #581](https://github.com/json-c/json-c/issues/581) - CMakeLists: do not enforce strict prototypes on Windows. \
diff --git a/comm/third_party/json-c/json.h b/comm/third_party/json-c/json.h
deleted file mode 100644
--- a/comm/third_party/json-c/json.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * $Id: json.h,v 1.6 2006/01/26 02:16:28 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- * Copyright (c) 2009 Hewlett-Packard Development Company, L.P.
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-/**
- * @file
- * @brief A convenience header that may be included instead of other individual ones.
- */
-#ifndef _json_h_
-#define _json_h_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "arraylist.h"
-#include "debug.h"
-#include "json_c_version.h"
-#include "json_object.h"
-#include "json_object_iterator.h"
-#include "json_pointer.h"
-#include "json_tokener.h"
-#include "json_util.h"
-#include "linkhash.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/comm/third_party/json-c/json.h.cmakein b/comm/third_party/json-c/json.h.cmakein
new file mode 100644
--- /dev/null
+++ b/comm/third_party/json-c/json.h.cmakein
@@ -0,0 +1,38 @@
+/*
+ * $Id: json.h,v 1.6 2006/01/26 02:16:28 mclark Exp $
+ *
+ * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
+ * Michael Clark <michael@metaparadigm.com>
+ * Copyright (c) 2009 Hewlett-Packard Development Company, L.P.
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See COPYING for details.
+ *
+ */
+
+/**
+ * @file
+ * @brief A convenience header that may be included instead of other individual ones.
+ */
+#ifndef _json_h_
+#define _json_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "arraylist.h"
+#include "debug.h"
+#include "json_c_version.h"
+#include "json_object.h"
+#include "json_object_iterator.h"
+@JSON_H_JSON_POINTER@
+#include "json_tokener.h"
+#include "json_util.h"
+#include "linkhash.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/comm/third_party/json-c/json_c_version.h b/comm/third_party/json-c/json_c_version.h
--- a/comm/third_party/json-c/json_c_version.h
+++ b/comm/third_party/json-c/json_c_version.h
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2012,2017,2019,2020 Eric Hawicz
+ * Copyright (c) 2012,2017-2022 Eric Haszlakiewicz
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See COPYING for details.
*/
@@ -15,18 +15,18 @@
#ifdef __cplusplus
extern "C" {
#endif
#define JSON_C_MAJOR_VERSION 0
-#define JSON_C_MINOR_VERSION 15
+#define JSON_C_MINOR_VERSION 16
#define JSON_C_MICRO_VERSION 0
#define JSON_C_VERSION_NUM \
((JSON_C_MAJOR_VERSION << 16) | (JSON_C_MINOR_VERSION << 8) | JSON_C_MICRO_VERSION)
-#define JSON_C_VERSION "0.15"
+#define JSON_C_VERSION "0.16"
#ifndef JSON_EXPORT
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && defined(JSON_C_DLL)
#define JSON_EXPORT __declspec(dllexport)
#else
#define JSON_EXPORT extern
#endif
#endif
diff --git a/comm/third_party/json-c/json_config.h.win32 b/comm/third_party/json-c/json_config.h.win32
deleted file mode 100644
--- a/comm/third_party/json-c/json_config.h.win32
+++ /dev/null
@@ -1,5 +0,0 @@
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#if defined(_MSC_VER) && _MSC_VER >= 1800
-#define JSON_C_HAVE_INTTYPES_H 1
-#endif
diff --git a/comm/third_party/json-c/json_object.c b/third_party/json-c/json_ob/commject.c
--- a/comm/third_party/json-c/json_object.c
+++ b/comm/third_party/json-c/json_object.c
@@ -11,11 +11,10 @@
#include "config.h"
#include "strerror_override.h"
#include <assert.h>
-#include <ctype.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#include <math.h>
#include <stddef.h>
@@ -33,12 +32,15 @@
#include "math_compat.h"
#include "printbuf.h"
#include "snprintf_compat.h"
#include "strdup_compat.h"
+/* Avoid ctype.h and locale overhead */
+#define is_plain_digit(c) ((c) >= '0' && (c) <= '9')
+
#if SIZEOF_LONG_LONG != SIZEOF_INT64_T
-#error "The long long type isn't 64-bits"
+#error The long long type is not 64-bits
#endif
#ifndef SSIZE_T_MAX
#if SIZEOF_SSIZE_T == SIZEOF_INT
#define SSIZE_T_MAX INT_MAX
@@ -49,13 +51,10 @@
#else
#error Unable to determine size of ssize_t
#endif
#endif
-// Don't define this. It's not thread-safe.
-/* #define REFCOUNT_DEBUG 1 */
-
const char *json_hex_chars = "0123456789abcdefABCDEF";
static void json_object_generic_delete(struct json_object *jso);
#if defined(_MSC_VER) && (_MSC_VER <= 1800)
@@ -157,45 +156,10 @@ static json_object_to_json_string_fn _js
* This should be used rather than assert() for unconditional abortion
* (in particular for code paths which are never supposed to be run).
* */
JSON_NORETURN static void json_abort(const char *message);
-/* ref count debugging */
-
-#ifdef REFCOUNT_DEBUG
-
-static struct lh_table *json_object_table;
-
-static void json_object_init(void) __attribute__((constructor));
-static void json_object_init(void)
-{
- MC_DEBUG("json_object_init: creating object table\n");
- json_object_table = lh_kptr_table_new(128, NULL);
-}
-
-static void json_object_fini(void) __attribute__((destructor));
-static void json_object_fini(void)
-{
- struct lh_entry *ent;
- if (MC_GET_DEBUG())
- {
- if (json_object_table->count)
- {
- MC_DEBUG("json_object_fini: %d referenced objects at exit\n",
- json_object_table->count);
- lh_foreach(json_object_table, ent)
- {
- struct json_object *obj = (struct json_object *)lh_entry_v(ent);
- MC_DEBUG("\t%s:%p\n", json_type_to_name(obj->o_type), obj);
- }
- }
- }
- MC_DEBUG("json_object_fini: freeing object table\n");
- lh_table_free(json_object_table);
-}
-#endif /* REFCOUNT_DEBUG */
-
/* helper for accessing the optimized string data component in json_object
*/
static inline char *get_string_component_mutable(struct json_object *jso)
{
if (JC_STRING_C(jso)->len < 0)
@@ -212,14 +176,15 @@ static inline const char *get_string_com
/* string escaping */
static int json_escape_str(struct printbuf *pb, const char *str, size_t len, int flags)
{
- int pos = 0, start_offset = 0;
+ size_t pos = 0, start_offset = 0;
unsigned char c;
- while (len--)
+ while (len)
{
+ --len;
c = str[pos];
switch (c)
{
case '\b':
case '\n':
@@ -233,11 +198,11 @@ static int json_escape_str(struct printb
{
pos++;
break;
}
- if (pos - start_offset > 0)
+ if (pos > start_offset)
printbuf_memappend(pb, str + start_offset, pos - start_offset);
if (c == '\b')
printbuf_memappend(pb, "\\b", 2);
else if (c == '\n')
@@ -259,11 +224,11 @@ static int json_escape_str(struct printb
break;
default:
if (c < ' ')
{
char sbuf[7];
- if (pos - start_offset > 0)
+ if (pos > start_offset)
printbuf_memappend(pb, str + start_offset,
pos - start_offset);
snprintf(sbuf, sizeof(sbuf), "\\u00%c%c", json_hex_chars[c >> 4],
json_hex_chars[c & 0xf]);
printbuf_memappend_fast(pb, sbuf, (int)sizeof(sbuf) - 1);
@@ -271,11 +236,11 @@ static int json_escape_str(struct printb
}
else
pos++;
}
}
- if (pos - start_offset > 0)
+ if (pos > start_offset)
printbuf_memappend(pb, str + start_offset, pos - start_offset);
return 0;
}
/* reference counting */
@@ -335,14 +300,10 @@ int json_object_put(struct json_object *
/* generic object construction and destruction parts */
static void json_object_generic_delete(struct json_object *jso)
{
-#ifdef REFCOUNT_DEBUG
- MC_DEBUG("json_object_delete_%s: %p\n", json_type_to_name(jso->o_type), jso);
- lh_table_delete(json_object_table, jso);
-#endif /* REFCOUNT_DEBUG */
printbuf_free(jso->_pb);
free(jso);
}
static inline struct json_object *json_object_new(enum json_type o_type, size_t alloc_size,
@@ -360,14 +321,10 @@ static inline struct json_object *json_o
jso->_pb = NULL;
jso->_user_delete = NULL;
jso->_userdata = NULL;
//jso->... // Type-specific fields must be set by caller
-#ifdef REFCOUNT_DEBUG
- lh_table_insert(json_object_table, jso, jso);
- MC_DEBUG("json_object_new_%s: %p\n", json_type_to_name(jso->o_type), jso);
-#endif /* REFCOUNT_DEBUG */
return jso;
}
/* type checking functions */
@@ -540,11 +497,11 @@ static int json_object_object_to_json_st
return printbuf_strappend(pb, /*{*/ "}");
}
static void json_object_lh_entry_free(struct lh_entry *ent)
{
- if (!ent->k_is_constant)
+ if (!lh_entry_k_is_constant(ent))
free(lh_entry_k(ent));
json_object_put((struct json_object *)lh_entry_v(ent));
}
static void json_object_object_delete(struct json_object *jso_base)
@@ -603,19 +560,19 @@ int json_object_object_add_ex(struct jso
return -1;
if (!existing_entry)
{
const void *const k =
- (opts & JSON_C_OBJECT_KEY_IS_CONSTANT) ? (const void *)key : strdup(key);
+ (opts & JSON_C_OBJECT_ADD_CONSTANT_KEY) ? (const void *)key : strdup(key);
if (k == NULL)
return -1;
return lh_table_insert_w_hash(JC_OBJECT(jso)->c_object, k, val, hash, opts);
}
existing_value = (json_object *)lh_entry_v(existing_entry);
if (existing_value)
json_object_put(existing_value);
- existing_entry->v = val;
+ lh_entry_set_val(existing_entry, val);
return 0;
}
int json_object_object_add(struct json_object *jso, const char *key, struct json_object *val)
{
@@ -733,11 +690,11 @@ struct json_object *json_object_new_int(
return json_object_new_int64(i);
}
int32_t json_object_get_int(const struct json_object *jso)
{
- int64_t cint64=0;
+ int64_t cint64 = 0;
double cdouble;
enum json_type o_type;
if (!jso)
return 0;
@@ -974,30 +931,59 @@ int json_c_set_serialization_double_form
tls_serialization_float_format = NULL;
}
#endif
if (global_serialization_float_format)
free(global_serialization_float_format);
- global_serialization_float_format = double_format ? strdup(double_format) : NULL;
+ if (double_format)
+ {
+ char *p = strdup(double_format);
+ if (p == NULL)
+ {
+ _json_c_set_last_err("json_c_set_serialization_double_format: "
+ "out of memory\n");
+ return -1;
+ }
+ global_serialization_float_format = p;
+ }
+ else
+ {
+ global_serialization_float_format = NULL;
+ }
}
else if (global_or_thread == JSON_C_OPTION_THREAD)
{
#if defined(HAVE___THREAD)
if (tls_serialization_float_format)
{
free(tls_serialization_float_format);
tls_serialization_float_format = NULL;
}
- tls_serialization_float_format = double_format ? strdup(double_format) : NULL;
+ if (double_format)
+ {
+ char *p = strdup(double_format);
+ if (p == NULL)
+ {
+ _json_c_set_last_err("json_c_set_serialization_double_format: "
+ "out of memory\n");
+ return -1;
+ }
+ tls_serialization_float_format = p;
+ }
+ else
+ {
+ tls_serialization_float_format = NULL;
+ }
#else
- _json_c_set_last_err("json_c_set_option: not compiled with __thread support\n");
+ _json_c_set_last_err("json_c_set_serialization_double_format: not compiled "
+ "with __thread support\n");
return -1;
#endif
}
else
{
- _json_c_set_last_err("json_c_set_option: invalid global_or_thread value: %d\n",
- global_or_thread);
+ _json_c_set_last_err("json_c_set_serialization_double_format: invalid "
+ "global_or_thread value: %d\n", global_or_thread);
return -1;
}
return 0;
}
@@ -1054,12 +1040,11 @@ static int json_object_double_to_json_st
if (format == std_format || strstr(format, ".0f") == NULL)
format_drops_decimals = 1;
looks_numeric = /* Looks like *some* kind of number */
- isdigit((unsigned char)buf[0]) ||
- (size > 1 && buf[0] == '-' && isdigit((unsigned char)buf[1]));
+ is_plain_digit(buf[0]) || (size > 1 && buf[0] == '-' && is_plain_digit(buf[1]));
if (size < (int)sizeof(buf) - 2 && looks_numeric && !p && /* Has no decimal point */
strchr(buf, 'e') == NULL && /* Not scientific notation */
format_drops_decimals)
{
@@ -1252,21 +1237,21 @@ static struct json_object *_json_object_
{
size_t objsize;
struct json_object_string *jso;
/*
- * Structures Actual memory layout
- * ------------------- --------------------
+ * Structures Actual memory layout
+ * ------------------- --------------------
* [json_object_string [json_object_string
* [json_object] [json_object]
- * ...other fields... ...other fields...
+ * ...other fields... ...other fields...
* c_string] len
- * bytes
+ * bytes
* of
* string
* data
- * \0]
+ * \0]
*/
if (len > (SSIZE_T_MAX - (sizeof(*jso) - sizeof(jso->c_string)) - 1))
return NULL;
objsize = (sizeof(*jso) - sizeof(jso->c_string)) + len + 1;
if (len < sizeof(void *))
@@ -1279,11 +1264,12 @@ static struct json_object *_json_object_
if (!jso)
return NULL;
jso->len = len;
memcpy(jso->c_string.idata, s, len);
- jso->c_string.idata[len] = '\0';
+ // Cast below needed for Clang UB sanitizer
+ ((char *)jso->c_string.idata)[len] = '\0';
return &jso->base;
}
struct json_object *json_object_new_string(const char *s)
{
@@ -1303,22 +1289,24 @@ const char *json_object_get_string(struc
{
case json_type_string: return get_string_component(jso);
default: return json_object_to_json_string(jso);
}
}
+
+static inline ssize_t _json_object_get_string_len(const struct json_object_string *jso)
+{
+ ssize_t len;
+ len = jso->len;
+ return (len < 0) ? -(ssize_t)len : len;
+}
int json_object_get_string_len(const struct json_object *jso)
{
- ssize_t len;
if (!jso)
return 0;
switch (jso->o_type)
{
- case json_type_string:
- {
- len = JC_STRING_C(jso)->len;
- return (len < 0) ? -(ssize_t)len : len;
- }
+ case json_type_string: return _json_object_get_string_len(JC_STRING_C(jso));
default: return 0;
}
}
static int _json_object_set_string_len(json_object *jso, const char *s, size_t len)
@@ -1327,13 +1315,14 @@ static int _json_object_set_string_len(j
ssize_t curlen;
ssize_t newlen;
if (jso == NULL || jso->o_type != json_type_string)
return 0;
- if (len >= SSIZE_T_MAX - 1)
+ if (len >= INT_MAX - 1)
// jso->len is a signed ssize_t, so it can't hold the
- // full size_t range.
+ // full size_t range. json_object_get_string_len returns
+ // length as int, cap length at INT_MAX.
return 0;
dstbuf = get_string_component_mutable(jso);
curlen = JC_STRING(jso)->len;
if (curlen < 0)
@@ -1603,13 +1592,14 @@ int json_object_equal(struct json_object
return (int1->cint.c_uint64 == (uint64_t)int2->cint.c_int64);
}
case json_type_string:
{
- return (json_object_get_string_len(jso1) == json_object_get_string_len(jso2) &&
+ return (_json_object_get_string_len(JC_STRING(jso1)) ==
+ _json_object_get_string_len(JC_STRING(jso2)) &&
memcmp(get_string_component(jso1), get_string_component(jso2),
- json_object_get_string_len(jso1)) == 0);
+ _json_object_get_string_len(JC_STRING(jso1))) == 0);
}
case json_type_object: return json_object_all_values_equal(jso1, jso2);
case json_type_array: return json_array_equal(jso1, jso2);
@@ -1626,18 +1616,26 @@ static int json_object_copy_serializer_d
return 0;
if (dst->_to_json_string == json_object_userdata_to_json_string ||
dst->_to_json_string == _json_object_userdata_to_json_string)
{
- dst->_userdata = strdup(src->_userdata);
+ char *p;
+ assert(src->_userdata);
+ p = strdup(src->_userdata);
+ if (p == NULL)
+ {
+ _json_c_set_last_err("json_object_copy_serializer_data: out of memory\n");
+ return -1;
+ }
+ dst->_userdata = p;
}
// else if ... other supported serializers ...
else
{
_json_c_set_last_err(
- "json_object_deep_copy: unable to copy unknown serializer data: %p\n",
- (void *)dst->_to_json_string);
+ "json_object_copy_serializer_data: unable to copy unknown serializer data: "
+ "%p\n", (void *)dst->_to_json_string);
return -1;
}
dst->_user_delete = src->_user_delete;
return 0;
}
@@ -1670,11 +1668,14 @@ int json_c_shallow_copy_default(json_obj
break;
default: json_abort("invalid cint_type");
}
break;
- case json_type_string: *dst = json_object_new_string(get_string_component(src)); break;
+ case json_type_string:
+ *dst = json_object_new_string_len(get_string_component(src),
+ _json_object_get_string_len(JC_STRING(src)));
+ break;
case json_type_object: *dst = json_object_new_object(); break;
case json_type_array: *dst = json_object_new_array(); break;
@@ -1722,12 +1723,12 @@ static int json_object_deep_copy_recursi
{
struct json_object *jso = NULL;
/* This handles the `json_type_null` case */
if (!iter.val)
jso = NULL;
- else if (json_object_deep_copy_recursive(iter.val, src, iter.key, -1, &jso,
- shallow_copy) < 0)
+ else if (json_object_deep_copy_recursive(iter.val, src, iter.key, UINT_MAX,
+ &jso, shallow_copy) < 0)
{
json_object_put(jso);
return -1;
}
@@ -1787,11 +1788,11 @@ int json_object_deep_copy(struct json_ob
}
if (shallow_copy == NULL)
shallow_copy = json_c_shallow_copy_default;
- rc = json_object_deep_copy_recursive(src, NULL, NULL, -1, dst, shallow_copy);
+ rc = json_object_deep_copy_recursive(src, NULL, NULL, UINT_MAX, dst, shallow_copy);
if (rc < 0)
{
json_object_put(*dst);
*dst = NULL;
}
diff --git a/comm/third_party/json-c/json_object.h b/third_party/json-c/json_ob/commject.h
--- a/comm/third_party/json-c/json_object.h
+++ b/comm/third_party/json-c/json_object.h
@@ -50,11 +50,11 @@ extern "C" {
/**
* A flag for the json_object_to_json_string_ext() and
* json_object_to_file_ext() functions which causes
* the output to be formatted.
*
- * See the "Two Space Tab" option at http://jsonformatter.curiousconcept.com/
+ * See the "Two Space Tab" option at https://jsonformatter.curiousconcept.com/
* for an example of the format.
*/
#define JSON_C_TO_STRING_PRETTY (1 << 1)
/**
* A flag for the json_object_to_json_string_ext() and
@@ -98,13 +98,21 @@ extern "C" {
* justified.
* The general use-case for this flag is cases where the
* key is given as a real constant value in the function
* call, e.g. as in
* json_object_object_add_ex(obj, "ip", json,
- * JSON_C_OBJECT_KEY_IS_CONSTANT);
+ * JSON_C_OBJECT_ADD_CONSTANT_KEY);
*/
-#define JSON_C_OBJECT_KEY_IS_CONSTANT (1 << 2)
+#define JSON_C_OBJECT_ADD_CONSTANT_KEY (1 << 2)
+/**
+ * This flag is an alias to JSON_C_OBJECT_ADD_CONSTANT_KEY.
+ * Historically, this flag was used first and the new name
+ * JSON_C_OBJECT_ADD_CONSTANT_KEY was introduced for version
+ * 0.16.00 in order to have regular naming.
+ * Use of this flag is now legacy.
+ */
+#define JSON_C_OBJECT_KEY_IS_CONSTANT JSON_C_OBJECT_ADD_CONSTANT_KEY
/**
* Set the global value of an option, which will apply to all
* current and future threads that have not set a thread-local value.
*
@@ -129,11 +137,11 @@ extern "C" {
* - Using an object field or array index (retrieved through
* `json_object_object_get()` or `json_object_array_get_idx()`)
* beyond the lifetime of the parent object.
* - Detaching an object field or array index from its parent object
* (using `json_object_object_del()` or `json_object_array_del_idx()`)
- * - Sharing a json_object with multiple (not necesarily parallel) threads
+ * - Sharing a json_object with multiple (not necessarily parallel) threads
* of execution that all expect to free it (with `json_object_put()`) when
* they're done.
*
* @param obj the json_object instance
* @see json_object_put()
@@ -468,23 +476,23 @@ JSON_EXPORT void json_object_object_del(
* @param obj the json_object instance
* @param key the local name for the char* key variable defined in the body
* @param val the local name for the json_object* object variable defined in
* the body
*/
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && __STDC_VERSION__ >= 199901L
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
#define json_object_object_foreach(obj, key, val) \
char *key = NULL; \
struct json_object *val __attribute__((__unused__)) = NULL; \
- for (struct lh_entry *entry##key = json_object_get_object(obj)->head, \
+ for (struct lh_entry *entry##key = lh_table_head(json_object_get_object(obj)), \
*entry_next##key = NULL; \
({ \
if (entry##key) \
{ \
key = (char *)lh_entry_k(entry##key); \
val = (struct json_object *)lh_entry_v(entry##key); \
- entry_next##key = entry##key->next; \
+ entry_next##key = lh_entry_next(entry##key); \
}; \
entry##key; \
}); \
entry##key = entry_next##key)
@@ -493,29 +501,29 @@ JSON_EXPORT void json_object_object_del(
#define json_object_object_foreach(obj, key, val) \
char *key = NULL; \
struct json_object *val = NULL; \
struct lh_entry *entry##key; \
struct lh_entry *entry_next##key = NULL; \
- for (entry##key = json_object_get_object(obj)->head; \
+ for (entry##key = lh_table_head(json_object_get_object(obj)); \
(entry##key ? (key = (char *)lh_entry_k(entry##key), \
val = (struct json_object *)lh_entry_v(entry##key), \
- entry_next##key = entry##key->next, entry##key) \
+ entry_next##key = lh_entry_next(entry##key), entry##key) \
: 0); \
entry##key = entry_next##key)
-#endif /* defined(__GNUC__) && !defined(__STRICT_ANSI__) && __STDC_VERSION__ >= 199901L */
+#endif /* defined(__GNUC__) && !defined(__STRICT_ANSI__) && (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) */
/** Iterate through all keys and values of an object (ANSI C Safe)
* @param obj the json_object instance
* @param iter the object iterator, use type json_object_iter
*/
#define json_object_object_foreachC(obj, iter) \
- for (iter.entry = json_object_get_object(obj)->head; \
+ for (iter.entry = lh_table_head(json_object_get_object(obj)); \
(iter.entry ? (iter.key = (char *)lh_entry_k(iter.entry), \
iter.val = (struct json_object *)lh_entry_v(iter.entry), iter.entry) \
: 0); \
- iter.entry = iter.entry->next)
+ iter.entry = lh_entry_next(iter.entry))
/* Array type methods */
/** Create a new empty json_object of type json_type_array
* with 32 slots allocated.
@@ -654,12 +662,13 @@ JSON_EXPORT struct json_object *json_obj
/** Get the json_bool value of a json_object
*
* The type is coerced to a json_bool if the passed object is not a json_bool.
* integer and double objects will return 0 if there value is zero
* or 1 otherwise. If the passed object is a string it will return
- * 1 if it has a non zero length. If any other object type is passed
- * 1 will be returned if the object is not NULL.
+ * 1 if it has a non zero length.
+ * If any other object type is passed 0 will be returned, even non-empty
+ * json_type_array and json_type_object objects.
*
* @param obj the json_object instance
* @returns a json_bool
*/
JSON_EXPORT json_bool json_object_get_boolean(const struct json_object *obj);
@@ -736,11 +745,11 @@ JSON_EXPORT int json_object_set_int(stru
* is set to INT64_MIN.
* Neither overflow nor underflow affect the return value.
*
* @param obj the json_object instance
* @param val the value to add
- * @returns 1 if the increment succeded, 0 otherwise
+ * @returns 1 if the increment succeeded, 0 otherwise
*/
JSON_EXPORT int json_object_int_inc(struct json_object *obj, int64_t val);
/** Get the int value of a json_object
*
@@ -1053,11 +1062,11 @@ JSON_EXPORT json_c_shallow_copy_fn json_
* make sure this pointer is initialized to NULL
* @param shallow_copy an optional function to copy individual objects, needed
* when custom serializers are in use. See also
* json_object set_serializer.
*
- * @returns 0 if the copy went well, -1 if an error occured during copy
+ * @returns 0 if the copy went well, -1 if an error occurred during copy
* or if the destination pointer is non-NULL
*/
JSON_EXPORT int json_object_deep_copy(struct json_object *src, struct json_object **dst,
json_c_shallow_copy_fn *shallow_copy);
diff --git a/comm/third_party/json-c/json_object_iterator.c b/third_party/json-c/json_ob/commject_iterator.c
--- a/comm/third_party/json-c/json_object_iterator.c
+++ b/comm/third_party/json-c/json_object_iterator.c
@@ -69,11 +69,11 @@ struct json_object_iterator json_object_
pTable = json_object_get_object(obj);
JASSERT(NULL != pTable);
/// @note For a pair-less Object, head is NULL, which matches our
/// definition of the "end" iterator
- iter.opaque_ = pTable->head;
+ iter.opaque_ = lh_table_head(pTable);
return iter;
}
/**
* ****************************************************************************
@@ -96,11 +96,11 @@ struct json_object_iterator json_object_
void json_object_iter_next(struct json_object_iterator *iter)
{
JASSERT(NULL != iter);
JASSERT(kObjectEndIterValue != iter->opaque_);
- iter->opaque_ = ((const struct lh_entry *)iter->opaque_)->next;
+ iter->opaque_ = lh_entry_next(((const struct lh_entry *)iter->opaque_));
}
/**
* ****************************************************************************
*/
diff --git a/comm/third_party/json-c/json_pointer.c b/comm/third_party/json-c/json_pointer.c
--- a/comm/third_party/json-c/json_pointer.c
+++ b/comm/third_party/json-c/json_pointer.c
@@ -8,20 +8,22 @@
#include "config.h"
#include "strerror_override.h"
-#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "json_pointer.h"
#include "strdup_compat.h"
#include "vasprintf_compat.h"
+/* Avoid ctype.h and locale overhead */
+#define is_plain_digit(c) ((c) >= '0' && (c) <= '9')
+
/**
* JavaScript Object Notation (JSON) Pointer
* RFC 6901 - https://tools.ietf.org/html/rfc6901
*/
@@ -45,11 +47,11 @@ static int is_valid_index(struct json_ob
/* this code-path optimizes a bit, for when we reference the 0-9 index range
* in a JSON array and because leading zeros not allowed
*/
if (len == 1)
{
- if (isdigit((unsigned char)path[0]))
+ if (is_plain_digit(path[0]))
{
*idx = (path[0] - '0');
goto check_oob;
}
errno = EINVAL;
@@ -62,11 +64,11 @@ static int is_valid_index(struct json_ob
return 0;
}
/* RFC states base-10 decimals */
for (i = 0; i < len; i++)
{
- if (!isdigit((unsigned char)path[i]))
+ if (!is_plain_digit(path[i]))
{
errno = EINVAL;
return 0;
}
}
diff --git a/comm/third_party/json-c/json_tokener.c b/comm/third_party/json-c/json_tokener.c
--- a/comm/third_party/json-c/json_tokener.c
+++ b/comm/third_party/json-c/json_tokener.c
@@ -8,18 +8,17 @@
* it under the terms of the MIT license. See COPYING for details.
*
*
* Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved.
* The copyrights to the contents of this file are licensed under the MIT License
- * (http://www.opensource.org/licenses/mit-license.php)
+ * (https://www.opensource.org/licenses/mit-license.php)
*/
#include "config.h"
#include "math_compat.h"
#include <assert.h>
-#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
@@ -51,19 +50,48 @@
#define strncasecmp _strnicmp
#elif !HAVE_STRNCASECMP
#error You do not have strncasecmp on your system.
#endif /* HAVE_STRNCASECMP */
+#if defined(_MSC_VER) && (_MSC_VER <= 1800)
+/* VS2013 doesn't know about "inline" */
+#define inline __inline
+#elif defined(AIX_CC)
+#define inline
+#endif
+
+/* The following helper functions are used to speed up parsing. They
+ * are faster than their ctype counterparts because they assume that
+ * the input is in ASCII and that the locale is set to "C". The
+ * compiler will also inline these functions, providing an additional
+ * speedup by saving on function calls.
+ */
+static inline int is_ws_char(char c)
+{
+ return c == ' '
+ || c == '\t'
+ || c == '\n'
+ || c == '\r';
+}
+
+static inline int is_hex_char(char c)
+{
+ return (c >= '0' && c <= '9')
+ || (c >= 'A' && c <= 'F')
+ || (c >= 'a' && c <= 'f');
+}
+
/* Use C99 NAN by default; if not available, nan("") should work too. */
#ifndef NAN
#define NAN nan("")
#endif /* !NAN */
static const char json_null_str[] = "null";
static const int json_null_str_len = sizeof(json_null_str) - 1;
static const char json_inf_str[] = "Infinity";
-static const char json_inf_str_lower[] = "infinity";
+/* Swapped case "Infinity" to avoid need to call tolower() on input chars: */
+static const char json_inf_str_invert[] = "iNFINITY";
static const unsigned int json_inf_str_len = sizeof(json_inf_str) - 1;
static const char json_nan_str[] = "NaN";
static const int json_nan_str_len = sizeof(json_nan_str) - 1;
static const char json_true_str[] = "true";
static const int json_true_str_len = sizeof(json_true_str) - 1;
@@ -132,10 +160,16 @@ struct json_tokener *json_tokener_new_ex
{
free(tok);
return NULL;
}
tok->pb = printbuf_new();
+ if (!tok->pb)
+ {
+ free(tok->stack);
+ free(tok);
+ return NULL;
+ }
tok->max_depth = depth;
json_tokener_reset(tok);
return tok;
}
@@ -314,11 +348,11 @@ struct json_object *json_tokener_parse_e
switch (state)
{
case json_tokener_state_eatws:
/* Advance until we change state */
- while (isspace((unsigned char)c))
+ while (is_ws_char(c))
{
if ((!ADVANCE_CHAR(str, tok)) || (!PEEK_CHAR(c, tok)))
goto out;
}
if (c == '/' && !(tok->flags & JSON_TOKENER_STRICT))
@@ -419,21 +453,19 @@ struct json_object *json_tokener_parse_e
* a character at a time.
* Trying to handle it both ways would make this code considerably more
* complicated with likely little performance benefit.
*/
int is_negative = 0;
- const char *_json_inf_str = json_inf_str;
- if (!(tok->flags & JSON_TOKENER_STRICT))
- _json_inf_str = json_inf_str_lower;
/* Note: tok->st_pos must be 0 when state is set to json_tokener_state_inf */
while (tok->st_pos < (int)json_inf_str_len)
{
char inf_char = *str;
- if (!(tok->flags & JSON_TOKENER_STRICT))
- inf_char = tolower((unsigned char)*str);
- if (inf_char != _json_inf_str[tok->st_pos])
+ if (inf_char != json_inf_str[tok->st_pos] &&
+ ((tok->flags & JSON_TOKENER_STRICT) ||
+ inf_char != json_inf_str_invert[tok->st_pos])
+ )
{
tok->err = json_tokener_error_parse_unexpected;
goto out;
}
tok->st_pos++;
@@ -645,11 +677,11 @@ struct json_object *json_tokener_parse_e
case json_tokener_state_escape_unicode:
{
/* Handle a 4-byte \uNNNN sequence, or two sequences if a surrogate pair */
while (1)
{
- if (!c || !strchr(json_hex_chars, c))
+ if (!c || !is_hex_char(c))
{
tok->err = json_tokener_error_parse_string;
goto out;
}
tok->ucs_char |=
@@ -712,11 +744,11 @@ struct json_object *json_tokener_parse_e
/*
* The next two characters should be \u, HOWEVER,
* we can't simply peek ahead here, because the
* characters we need might not be passed to us
* until a subsequent call to json_tokener_parse.
- * Instead, transition throug a couple of states.
+ * Instead, transition through a couple of states.
* (now):
* _escape_unicode => _unicode_need_escape
* (see a '\\' char):
* _unicode_need_escape => _unicode_need_u
* (see a 'u' char):
@@ -918,11 +950,11 @@ struct json_object *json_tokener_parse_e
However, if we're at the top-level, use the number as-is
because c can be part of a new object to parse on the
next call to json_tokener_parse().
*/
if (tok->depth > 0 && c != ',' && c != ']' && c != '}' && c != '/' &&
- c != 'I' && c != 'i' && !isspace((unsigned char)c))
+ c != 'I' && c != 'i' && !is_ws_char(c))
{
tok->err = json_tokener_error_parse_number;
goto out;
}
if (case_len > 0)
diff --git a/comm/third_party/json-c/json_types.h b/comm/third_party/json-c/json_types.h
--- a/comm/third_party/json-c/json_types.h
+++ b/comm/third_party/json-c/json_types.h
@@ -16,11 +16,11 @@
#ifdef __cplusplus
extern "C" {
#endif
#ifndef JSON_EXPORT
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && defined(JSON_C_DLL)
#define JSON_EXPORT __declspec(dllexport)
#else
#define JSON_EXPORT extern
#endif
#endif
diff --git a/comm/third_party/json-c/json_util.c b/comm/third_party/json-c/json_util.c
--- a/comm/third_party/json-c/json_util.c
+++ b/comm/third_party/json-c/json_util.c
@@ -12,11 +12,10 @@
#include "config.h"
#undef realloc
#include "strerror_override.h"
-#include <ctype.h>
#include <limits.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
@@ -90,21 +89,21 @@ struct json_object *json_object_from_fd_
int depth = JSON_TOKENER_DEFAULT_DEPTH;
json_tokener *tok;
if (!(pb = printbuf_new()))
{
- _json_c_set_last_err("json_object_from_file: printbuf_new failed\n");
+ _json_c_set_last_err("json_object_from_fd_ex: printbuf_new failed\n");
return NULL;
}
if (in_depth != -1)
depth = in_depth;
tok = json_tokener_new_ex(depth);
if (!tok)
{
_json_c_set_last_err(
- "json_object_from_fd: unable to allocate json_tokener(depth=%d): %s\n", depth,
+ "json_object_from_fd_ex: unable to allocate json_tokener(depth=%d): %s\n", depth,
strerror(errno));
printbuf_free(pb);
return NULL;
}
@@ -112,11 +111,11 @@ struct json_object *json_object_from_fd_
{
printbuf_memappend(pb, buf, ret);
}
if (ret < 0)
{
- _json_c_set_last_err("json_object_from_fd: error reading fd %d: %s\n", fd,
+ _json_c_set_last_err("json_object_from_fd_ex: error reading fd %d: %s\n", fd,
strerror(errno));
json_tokener_free(tok);
printbuf_free(pb);
return NULL;
}
@@ -136,12 +135,12 @@ struct json_object *json_object_from_fil
struct json_object *obj;
int fd;
if ((fd = open(filename, O_RDONLY)) < 0)
{
- _json_c_set_last_err("json_object_from_file: error opening file %s: %s\n", filename,
- strerror(errno));
+ _json_c_set_last_err("json_object_from_file: error opening file %s: %s\n",
+ filename, strerror(errno));
return NULL;
}
obj = json_object_from_fd(fd);
close(fd);
return obj;
@@ -154,18 +153,18 @@ int json_object_to_file_ext(const char *
int fd, ret;
int saved_errno;
if (!obj)
{
- _json_c_set_last_err("json_object_to_file: object is null\n");
+ _json_c_set_last_err("json_object_to_file_ext: object is null\n");
return -1;
}
if ((fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, 0644)) < 0)
{
- _json_c_set_last_err("json_object_to_file: error opening file %s: %s\n", filename,
- strerror(errno));
+ _json_c_set_last_err("json_object_to_file_ext: error opening file %s: %s\n",
+ filename, strerror(errno));
return -1;
}
ret = _json_object_to_fd(fd, obj, flags, filename);
saved_errno = errno;
close(fd);
@@ -201,11 +200,11 @@ static int _json_object_to_fd(int fd, st
wpos = 0;
while (wpos < wsize)
{
if ((ret = write(fd, json_str + wpos, wsize - wpos)) < 0)
{
- _json_c_set_last_err("json_object_to_file: error writing file %s: %s\n",
+ _json_c_set_last_err("json_object_to_fd: error writing file %s: %s\n",
filename, strerror(errno));
return -1;
}
/* because of the above check for ret < 0, we can safely cast and add */
@@ -287,11 +286,11 @@ static const char *json_type_name[] = {
const char *json_type_to_name(enum json_type o_type)
{
int o_type_int = (int)o_type;
if (o_type_int < 0 || o_type_int >= (int)NELEM(json_type_name))
{
- _json_c_set_last_err("json_type_to_name: type %d is out of range [0,%d]\n", o_type,
- NELEM(json_type_name));
+ _json_c_set_last_err("json_type_to_name: type %d is out of range [0,%u]\n", o_type,
+ (unsigned)NELEM(json_type_name));
return NULL;
}
return json_type_name[o_type];
}
diff --git a/comm/third_party/json-c/linkhash.c b/comm/third_party/json-c/linkhash.c
--- a/comm/third_party/json-c/linkhash.c
+++ b/comm/third_party/json-c/linkhash.c
@@ -63,13 +63,13 @@ int lh_ptr_equal(const void *k1, const v
return (k1 == k2);
}
/*
* hashlittle from lookup3.c, by Bob Jenkins, May 2006, Public Domain.
- * http://burtleburtle.net/bob/c/lookup3.c
+ * https://burtleburtle.net/bob/c/lookup3.c
* minor modifications to make functions static so no symbols are exported
- * minor mofifications to compile with -Werror
+ * minor modifications to compile with -Werror
*/
/*
-------------------------------------------------------------------------------
lookup3.c, by Bob Jenkins, May 2006, Public Domain.
@@ -79,11 +79,11 @@ hashword(), hashlittle(), hashlittle2(),
are externally useful functions. Routines to test the hash are included
if SELF_TEST is defined. You can use this free for any purpose. It's in
the public domain. It has no warranty.
You probably want to use hashlittle(). hashlittle() and hashbig()
-hash byte arrays. hashlittle() is is faster than hashbig() on
+hash byte arrays. hashlittle() is faster than hashbig() on
little-endian machines. Intel and AMD are little-endian machines.
On second thought, you probably want hashlittle2(), which is identical to
hashlittle() except it returns two 32-bit hashes for the price of one.
You could implement hashbig2() if you wanted but I haven't bothered here.
@@ -154,11 +154,11 @@ satisfy this are
4 6 8 16 19 4
9 15 3 18 27 15
14 9 3 7 17 3
Well, "9 15 3 18 27 15" didn't quite get 32 bits diffing
for "differ" defined as + with a one-bit base and a two-bit delta. I
-used http://burtleburtle.net/bob/hash/avalanche.html to choose
+used https://burtleburtle.net/bob/hash/avalanche.html to choose
the operations, constants, and arrangements of the variables.
This does not achieve avalanche. There are input bits of (a,b,c)
that fail to affect some output bits of (a,b,c), especially of a. The
most thoroughly mixed value is c, but it doesn't really even achieve
@@ -283,13 +283,13 @@ static uint32_t hashlittle(const void *k
* then masks off the part it's not allowed to read. Because the
* string is aligned, the masked-off tail is in the same word as the
* rest of the string. Every machine with memory protection I've seen
* does it on word boundaries, so is OK with this. But VALGRIND will
* still catch it and complain. The masking trick does make the hash
- * noticably faster for short strings (like English words).
+ * noticeably faster for short strings (like English words).
* AddressSanitizer is similarly picky about overrunning
- * the buffer. (http://clang.llvm.org/docs/AddressSanitizer.html
+ * the buffer. (https://clang.llvm.org/docs/AddressSanitizer.html)
*/
#ifdef VALGRIND
#define PRECISE_MEMORY_ACCESS 1
#elif defined(__SANITIZE_ADDRESS__) /* GCC's ASAN */
#define PRECISE_MEMORY_ACCESS 1
@@ -437,12 +437,12 @@ static uint32_t hashlittle(const void *k
final(a,b,c);
return c;
}
/* clang-format on */
-/* a simple hash function similiar to what perl does for strings.
- * for good results, the string should not be excessivly large.
+/* a simple hash function similar to what perl does for strings.
+ * for good results, the string should not be excessively large.
*/
static unsigned long lh_perllike_str_hash(const void *k)
{
const char *rkey = (const char *)k;
unsigned hashval = 1;
@@ -463,11 +463,11 @@ static unsigned long lh_char_hash(const
static volatile RANDOM_SEED_TYPE random_seed = -1;
if (random_seed == -1)
{
RANDOM_SEED_TYPE seed;
- /* we can't use -1 as it is the unitialized sentinel */
+ /* we can't use -1 as it is the uninitialized sentinel */
while ((seed = json_c_get_random_seed()) == -1) {}
#if SIZEOF_INT == 8 && defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
#define USE_SYNC_COMPARE_AND_SWAP 1
#endif
#if SIZEOF_INT == 4 && defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
@@ -479,16 +479,16 @@ static unsigned long lh_char_hash(const
#if defined USE_SYNC_COMPARE_AND_SWAP
(void)__sync_val_compare_and_swap(&random_seed, -1, seed);
#elif defined _MSC_VER || defined __MINGW32__
InterlockedCompareExchange(&random_seed, seed, -1);
#else
- //#warning "racy random seed initializtion if used by multiple threads"
+ //#warning "racy random seed initialization if used by multiple threads"
random_seed = seed; /* potentially racy */
#endif
}
- return hashlittle((const char *)k, strlen((const char *)k), random_seed);
+ return hashlittle((const char *)k, strlen((const char *)k), (uint32_t)random_seed);
}
int lh_char_equal(const void *k1, const void *k2)
{
return (strcmp((const char *)k1, (const char *)k2) == 0);
@@ -544,11 +544,11 @@ int lh_table_resize(struct lh_table *t,
for (ent = t->head; ent != NULL; ent = ent->next)
{
unsigned long h = lh_get_hash(new_t, ent->k);
unsigned int opts = 0;
if (ent->k_is_constant)
- opts = JSON_C_OBJECT_KEY_IS_CONSTANT;
+ opts = JSON_C_OBJECT_ADD_CONSTANT_KEY;
if (lh_table_insert_w_hash(new_t, ent->k, ent->v, h, opts) != 0)
{
lh_table_free(new_t);
return -1;
}
@@ -597,11 +597,11 @@ int lh_table_insert_w_hash(struct lh_tab
if ((int)++n == t->size)
n = 0;
}
t->table[n].k = k;
- t->table[n].k_is_constant = (opts & JSON_C_OBJECT_KEY_IS_CONSTANT);
+ t->table[n].k_is_constant = (opts & JSON_C_OBJECT_ADD_CONSTANT_KEY);
t->table[n].v = v;
t->count++;
if (t->head == NULL)
{
diff --git a/comm/third_party/json-c/linkhash.h b/comm/third_party/json-c/linkhash.h
--- a/comm/third_party/json-c/linkhash.h
+++ b/comm/third_party/json-c/linkhash.h
@@ -14,12 +14,12 @@
* @file
* @brief Internal methods for working with json_type_object objects. Although
* this is exposed by the json_object_get_object() function and within the
* json_object_iter type, it is not recommended for direct use.
*/
-#ifndef _linkhash_h_
-#define _linkhash_h_
+#ifndef _json_c_linkhash_h_
+#define _json_c_linkhash_h_
#include "json_object.h"
#ifdef __cplusplus
extern "C" {
@@ -78,86 +78,106 @@ typedef unsigned long(lh_hash_fn)(const
* callback function prototypes
*/
typedef int(lh_equal_fn)(const void *k1, const void *k2);
/**
- * An entry in the hash table
+ * An entry in the hash table. Outside of linkhash.c, treat this as opaque.
*/
struct lh_entry
{
/**
- * The key. Use lh_entry_k() instead of accessing this directly.
+ * The key.
+ * @deprecated Use lh_entry_k() instead of accessing this directly.
*/
const void *k;
/**
* A flag for users of linkhash to know whether or not they
* need to free k.
+ * @deprecated use lh_entry_k_is_constant() instead.
*/
int k_is_constant;
/**
- * The value. Use lh_entry_v() instead of accessing this directly.
+ * The value.
+ * @deprecated Use lh_entry_v() instead of accessing this directly.
*/
const void *v;
/**
- * The next entry
+ * The next entry.
+ * @deprecated Use lh_entry_next() instead of accessing this directly.
*/
struct lh_entry *next;
/**
* The previous entry.
+ * @deprecated Use lh_entry_prev() instead of accessing this directly.
*/
struct lh_entry *prev;
};
/**
- * The hash table structure.
+ * The hash table structure. Outside of linkhash.c, treat this as opaque.
*/
struct lh_table
{
/**
* Size of our hash.
+ * @deprecated do not use outside of linkhash.c
*/
int size;
/**
* Numbers of entries.
+ * @deprecated Use lh_table_length() instead.
*/
int count;
/**
* The first entry.
+ * @deprecated Use lh_table_head() instead.
*/
struct lh_entry *head;
/**
* The last entry.
+ * @deprecated Do not use, may be removed in a future release.
*/
struct lh_entry *tail;
+ /**
+ * Internal storage of the actual table of entries.
+ * @deprecated do not use outside of linkhash.c
+ */
struct lh_entry *table;
/**
- * A pointer onto the function responsible for freeing an entry.
+ * A pointer to the function responsible for freeing an entry.
+ * @deprecated do not use outside of linkhash.c
*/
lh_entry_free_fn *free_fn;
+ /**
+ * @deprecated do not use outside of linkhash.c
+ */
lh_hash_fn *hash_fn;
+ /**
+ * @deprecated do not use outside of linkhash.c
+ */
lh_equal_fn *equal_fn;
};
typedef struct lh_table lh_table;
/**
* Convenience list iterator.
*/
-#define lh_foreach(table, entry) for (entry = table->head; entry; entry = entry->next)
+#define lh_foreach(table, entry) for (entry = lh_table_head(table); entry; entry = lh_entry_next(entry))
/**
* lh_foreach_safe allows calling of deletion routine while iterating.
*
* @param table a struct lh_table * to iterate over
* @param entry a struct lh_entry * variable to hold each element
* @param tmp a struct lh_entry * variable to hold a temporary pointer to the next element
*/
#define lh_foreach_safe(table, entry, tmp) \
- for (entry = table->head; entry && ((tmp = entry->next) || 1); entry = tmp)
+ for (entry = lh_table_head(table); entry && ((tmp = lh_entry_next(entry)) || 1); entry = tmp)
/**
* Create a new linkhash table.
*
* @param size initial table size. The table is automatically resized
@@ -229,11 +249,11 @@ extern int lh_table_insert(struct lh_tab
*
* @param t the table to insert into.
* @param k a pointer to the key to insert.
* @param v a pointer to the value to insert.
* @param h hash value of the key to insert
- * @param opts if set to JSON_C_OBJECT_KEY_IS_CONSTANT, sets lh_entry.k_is_constant
+ * @param opts if set to JSON_C_OBJECT_ADD_CONSTANT_KEY, sets lh_entry.k_is_constant
* so t's free function knows to avoid freeing the key.
*/
extern int lh_table_insert_w_hash(struct lh_table *t, const void *k, const void *v,
const unsigned long h, const unsigned opts);
@@ -293,10 +313,13 @@ extern int lh_table_delete_entry(struct
* @return 0 if the item was deleted.
* @return -1 if it was not found.
*/
extern int lh_table_delete(struct lh_table *t, const void *k);
+/**
+ * Return the number of entries in the table.
+ */
extern int lh_table_length(struct lh_table *t);
/**
* Resizes the specified table.
*
@@ -317,13 +340,22 @@ int lh_table_resize(struct lh_table *t,
#else
#define _LH_INLINE inline
#endif
/**
+ * Return the first entry in the lh_table.
+ * @see lh_entry_next()
+ */
+static _LH_INLINE struct lh_entry *lh_table_head(const lh_table *t)
+{
+ return t->head;
+}
+
+/**
* Calculate the hash of a key for a given table.
*
- * This is an exension to support functions that need to calculate
+ * This is an extension to support functions that need to calculate
* the hash several times and allows them to do it just once and then pass
* in the hash to all utility functions. Depending on use case, this can be a
* considerable performance improvement.
* @param t the table (used to obtain hash function)
* @param k a pointer to the key to lookup
@@ -332,11 +364,10 @@ int lh_table_resize(struct lh_table *t,
static _LH_INLINE unsigned long lh_get_hash(const struct lh_table *t, const void *k)
{
return t->hash_fn(k);
}
-#undef _LH_INLINE
/**
* @deprecated Don't use this outside of linkhash.h:
*/
#ifdef __UNCONST
@@ -348,21 +379,68 @@ static _LH_INLINE unsigned long lh_get_h
/**
* Return a non-const version of lh_entry.k.
*
* lh_entry.k is const to indicate and help ensure that linkhash itself doesn't modify
* it, but callers are allowed to do what they want with it.
- * See also lh_entry.k_is_constant
+ * @see lh_entry_k_is_constant()
*/
-#define lh_entry_k(entry) _LH_UNCONST((entry)->k)
+static _LH_INLINE void *lh_entry_k(const struct lh_entry *e)
+{
+ return _LH_UNCONST(e->k);
+}
+
+/**
+ * Returns 1 if the key for the given entry is constant, and thus
+ * does not need to be freed when the lh_entry is freed.
+ * @see lh_table_insert_w_hash()
+ */
+static _LH_INLINE int lh_entry_k_is_constant(const struct lh_entry *e)
+{
+ return e->k_is_constant;
+}
/**
* Return a non-const version of lh_entry.v.
*
* v is const to indicate and help ensure that linkhash itself doesn't modify
* it, but callers are allowed to do what they want with it.
*/
-#define lh_entry_v(entry) _LH_UNCONST((entry)->v)
+static _LH_INLINE void *lh_entry_v(const struct lh_entry *e)
+{
+ return _LH_UNCONST(e->v);
+}
+
+/**
+ * Change the value for an entry. The caller is responsible for freeing
+ * the previous value.
+ */
+static _LH_INLINE void lh_entry_set_val(struct lh_entry *e, void *newval)
+{
+ e->v = newval;
+}
+
+/**
+ * Return the next element, or NULL if there is no next element.
+ * @see lh_table_head()
+ * @see lh_entry_prev()
+ */
+static _LH_INLINE struct lh_entry *lh_entry_next(const struct lh_entry *e)
+{
+ return e->next;
+}
+
+/**
+ * Return the previous element, or NULL if there is no previous element.
+ * @see lh_table_head()
+ * @see lh_entry_next()
+ */
+static _LH_INLINE struct lh_entry *lh_entry_prev(const struct lh_entry *e)
+{
+ return e->prev;
+}
+
+#undef _LH_INLINE
#ifdef __cplusplus
}
#endif
diff --git a/comm/third_party/json-c/moz.build b/third_party/json-c/moz.b/commuild
--- a/comm/third_party/json-c/moz.build
+++ b/comm/third_party/json-c/moz.build
@@ -21,10 +21,22 @@ else:
DEFINES["_GNU_SOURCE"] = True
DEFINES["CC"] = CONFIG["_CC"]
CONFIGURE_DEFINE_FILES += ["config.h", "json_config.h"]
+ GeneratedFile(
+ "json.h",
+ script="/python/mozbuild/mozbuild/action/preprocessor.py",
+ entry_point="generate",
+ inputs=["json.h.cmakein"],
+ flags=[
+ "--marker", "%",
+ "-F", "substitution",
+ "-DJSON_H_JSON_POINTER=#include \"json_pointer.h\""
+ ]
+ )
+
SOURCES += [
"arraylist.c",
"debug.c",
"json_c_version.c",
"json_object.c",
diff --git a/comm/third_party/json-c/printbuf.c b/third_party/json-c/printb/commuf.c
--- a/comm/third_party/json-c/printbuf.c
+++ b/comm/third_party/json-c/printbuf.c
@@ -8,11 +8,11 @@
* it under the terms of the MIT license. See COPYING for details.
*
*
* Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved.
* The copyrights to the contents of this file are licensed under the MIT License
- * (http://www.opensource.org/licenses/mit-license.php)
+ * (https://www.opensource.org/licenses/mit-license.php)
*/
#include "config.h"
#include <limits.h>
@@ -89,11 +89,11 @@ static int printbuf_extend(struct printb
}
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)
+ if (size < 0 || size > INT_MAX - p->bpos - 1)
return -1;
if (p->size <= p->bpos + size + 1)
{
if (printbuf_extend(p, p->bpos + size + 1) < 0)
return -1;
@@ -109,19 +109,21 @@ int printbuf_memset(struct printbuf *pb,
int size_needed;
if (offset == -1)
offset = pb->bpos;
/* Prevent signed integer overflows with large buffers. */
- if (len > INT_MAX - offset)
+ if (len < 0 || offset < -1 || len > INT_MAX - offset)
return -1;
size_needed = offset + len;
if (pb->size < size_needed)
{
if (printbuf_extend(pb, size_needed) < 0)
return -1;
}
+ if (pb->bpos < offset)
+ memset(pb->buf + pb->bpos, '\0', offset - pb->bpos);
memset(pb->buf + offset, charvalue, len);
if (pb->bpos < size_needed)
pb->bpos = size_needed;
return 0;
@@ -132,37 +134,36 @@ int sprintbuf(struct printbuf *p, const
va_list ap;
char *t;
int size;
char buf[128];
- /* user stack buffer first */
+ /* use stack buffer first */
va_start(ap, msg);
size = vsnprintf(buf, 128, msg, ap);
va_end(ap);
/* if string is greater than stack buffer, then use dynamic string
- * with vasprintf. Note: some implementation of vsnprintf return -1
+ * with vasprintf. Note: some implementations of vsnprintf return -1
* if output is truncated whereas some return the number of bytes that
* would have been written - this code handles both cases.
*/
- if (size == -1 || size > 127)
+ if (size < 0 || size > 127)
{
va_start(ap, msg);
if ((size = vasprintf(&t, msg, ap)) < 0)
{
va_end(ap);
return -1;
}
va_end(ap);
- printbuf_memappend(p, t, size);
+ size = printbuf_memappend(p, t, size);
free(t);
- return size;
}
else
{
- printbuf_memappend(p, buf, size);
- return size;
+ size = printbuf_memappend(p, buf, size);
}
+ return size;
}
void printbuf_reset(struct printbuf *p)
{
p->buf[0] = '\0';
diff --git a/comm/third_party/json-c/printbuf.h b/third_party/json-c/printb/commuf.h
--- a/comm/third_party/json-c/printbuf.h
+++ b/comm/third_party/json-c/printbuf.h
@@ -8,25 +8,25 @@
* it under the terms of the MIT license. See COPYING for details.
*
*
* Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved.
* The copyrights to the contents of this file are licensed under the MIT License
- * (http://www.opensource.org/licenses/mit-license.php)
+ * (https://www.opensource.org/licenses/mit-license.php)
*/
/**
* @file
- * @brief Internal string buffer handing. Unless you're writing a
+ * @brief Internal string buffer handling. Unless you're writing a
* json_object_to_json_string_fn implementation for use with
* json_object_set_serializer() direct use of this is not
* recommended.
*/
-#ifndef _printbuf_h_
-#define _printbuf_h_
+#ifndef _json_c_printbuf_h_
+#define _json_c_printbuf_h_
#ifndef JSON_EXPORT
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && defined(JSON_C_DLL)
#define JSON_EXPORT __declspec(dllexport)
#else
#define JSON_EXPORT extern
#endif
#endif
diff --git a/comm/third_party/json-c/random_seed.c b/comm/third_party/json-c/random_seed.c
--- a/comm/third_party/json-c/random_seed.c
+++ b/comm/third_party/json-c/random_seed.c
@@ -11,13 +11,27 @@
#include "random_seed.h"
#include "config.h"
#include "strerror_override.h"
#include <stdio.h>
+#include <stdlib.h>
+#ifdef HAVE_BSD_STDLIB_H
+#include <bsd/stdlib.h>
+#endif
#define DEBUG_SEED(s)
+#if defined(__APPLE__) || defined(__unix__) || defined(__linux__)
+#define HAVE_DEV_RANDOM 1
+#endif
+
+#ifdef HAVE_ARC4RANDOM
+#undef HAVE_GETRANDOM
+#undef HAVE_DEV_RANDOM
+#undef HAVE_CRYPTGENRANDOM
+#endif
+
#if defined ENABLE_RDRAND
/* cpuid */
#if defined __GNUC__ && (defined __i386__ || defined __x86_64__)
@@ -153,59 +167,88 @@ retry:
#endif
#endif
#endif /* defined ENABLE_RDRAND */
-/* has_dev_urandom */
+#ifdef HAVE_GETRANDOM
+
+#include <stdlib.h>
+#ifdef HAVE_SYS_RANDOM_H
+#include <sys/random.h>
+#endif
+
+static int get_getrandom_seed(int *seed)
+{
+ DEBUG_SEED("get_getrandom_seed");
+
+ ssize_t ret;
+
+ do
+ {
+ ret = getrandom(seed, sizeof(*seed), GRND_NONBLOCK);
+ } while ((ret == -1) && (errno == EINTR));
-#if defined(__APPLE__) || defined(__unix__) || defined(__linux__)
+ if (ret == -1)
+ {
+ if (errno == ENOSYS) /* syscall not available in kernel */
+ return -1;
+ if (errno == EAGAIN) /* entropy not yet initialized */
+ return -1;
+
+ fprintf(stderr, "error from getrandom(): %s", strerror(errno));
+ return -1;
+ }
+
+ if (ret != sizeof(*seed))
+ return -1;
+
+ return 0;
+}
+#endif /* defined HAVE_GETRANDOM */
+
+/* get_dev_random_seed */
+
+#ifdef HAVE_DEV_RANDOM
#include <fcntl.h>
#include <string.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
#include <stdlib.h>
#include <sys/stat.h>
-#define HAVE_DEV_RANDOM 1
-
static const char *dev_random_file = "/dev/urandom";
-static int has_dev_urandom(void)
+static int get_dev_random_seed(int *seed)
{
+ DEBUG_SEED("get_dev_random_seed");
+
struct stat buf;
if (stat(dev_random_file, &buf))
- {
- return 0;
- }
- return ((buf.st_mode & S_IFCHR) != 0);
-}
-
-/* get_dev_random_seed */
-
-static int get_dev_random_seed(void)
-{
- DEBUG_SEED("get_dev_random_seed");
+ return -1;
+ if ((buf.st_mode & S_IFCHR) == 0)
+ return -1;
int fd = open(dev_random_file, O_RDONLY);
if (fd < 0)
{
fprintf(stderr, "error opening %s: %s", dev_random_file, strerror(errno));
- exit(1);
+ return -1;
}
- int r;
- ssize_t nread = read(fd, &r, sizeof(r));
- if (nread != sizeof(r))
+ ssize_t nread = read(fd, seed, sizeof(*seed));
+
+ close(fd);
+
+ if (nread != sizeof(*seed))
{
fprintf(stderr, "error short read %s: %s", dev_random_file, strerror(errno));
- exit(1);
+ return -1;
}
- close(fd);
- return r;
+ return 0;
}
#endif
/* get_cryptgenrandom_seed */
@@ -224,55 +267,54 @@ static int get_dev_random_seed(void)
/* clang-format on */
#ifndef __GNUC__
#pragma comment(lib, "advapi32.lib")
#endif
-static int get_time_seed(void);
-
-static int get_cryptgenrandom_seed(void)
+static int get_cryptgenrandom_seed(int *seed)
{
HCRYPTPROV hProvider = 0;
DWORD dwFlags = CRYPT_VERIFYCONTEXT;
- int r;
DEBUG_SEED("get_cryptgenrandom_seed");
/* WinNT 4 and Win98 do no support CRYPT_SILENT */
if (LOBYTE(LOWORD(GetVersion())) > 4)
dwFlags |= CRYPT_SILENT;
if (!CryptAcquireContextA(&hProvider, 0, 0, PROV_RSA_FULL, dwFlags))
{
fprintf(stderr, "error CryptAcquireContextA 0x%08lx", GetLastError());
- r = get_time_seed();
+ return -1;
}
else
{
- BOOL ret = CryptGenRandom(hProvider, sizeof(r), (BYTE*)&r);
+ BOOL ret = CryptGenRandom(hProvider, sizeof(*seed), (BYTE *)seed);
CryptReleaseContext(hProvider, 0);
if (!ret)
{
fprintf(stderr, "error CryptGenRandom 0x%08lx", GetLastError());
- r = get_time_seed();
+ return -1;
}
}
- return r;
+ return 0;
}
#endif
/* get_time_seed */
+#ifndef HAVE_ARC4RANDOM
#include <time.h>
static int get_time_seed(void)
{
DEBUG_SEED("get_time_seed");
- return (int)time(NULL) * 433494437;
+ return (unsigned)time(NULL) * 433494437;
}
+#endif
/* json_c_get_random_seed */
int json_c_get_random_seed(void)
{
@@ -281,14 +323,33 @@ int json_c_get_random_seed(void)
#endif
#if defined HAVE_RDRAND && HAVE_RDRAND
if (has_rdrand())
return get_rdrand_seed();
#endif
+#ifdef HAVE_ARC4RANDOM
+ /* arc4random never fails, so use it if it's available */
+ return arc4random();
+#else
+#ifdef HAVE_GETRANDOM
+ {
+ int seed = 0;
+ if (get_getrandom_seed(&seed) == 0)
+ return seed;
+ }
+#endif
#if defined HAVE_DEV_RANDOM && HAVE_DEV_RANDOM
- if (has_dev_urandom())
- return get_dev_random_seed();
+ {
+ int seed = 0;
+ if (get_dev_random_seed(&seed) == 0)
+ return seed;
+ }
#endif
#if defined HAVE_CRYPTGENRANDOM && HAVE_CRYPTGENRANDOM
- return get_cryptgenrandom_seed();
+ {
+ int seed = 0;
+ if (get_cryptgenrandom_seed(&seed) == 0)
+ return seed;
+ }
#endif
return get_time_seed();
+#endif /* !HAVE_ARC4RANDOM */
}
diff --git a/comm/third_party/json-c/strerror_override.c b/comm/third_party/json-c/strerror_override.c
--- a/comm/third_party/json-c/strerror_override.c
+++ b/comm/third_party/json-c/strerror_override.c
@@ -92,18 +92,19 @@ char *_json_c_strerror(int errno_in)
errno_buf[start_idx] = '\0';
return errno_buf;
}
// It's not one of the known errno values, return the numeric value.
- for (ii = 0; errno_in > 10; errno_in /= 10, ii++)
+ for (ii = 0; errno_in >= 10; errno_in /= 10, ii++)
{
digbuf[ii] = "0123456789"[(errno_in % 10)];
}
digbuf[ii] = "0123456789"[(errno_in % 10)];
// Reverse the digits
for (start_idx = sizeof(PREFIX) - 1; ii >= 0; ii--, start_idx++)
{
errno_buf[start_idx] = digbuf[ii];
}
+ errno_buf[start_idx] = '\0';
return errno_buf;
}
diff --git a/comm/third_party/json-c/vasprintf_compat.h b/comm/third_party/json-c/vasprintf_compat.h
--- a/comm/third_party/json-c/vasprintf_compat.h
+++ b/comm/third_party/json-c/vasprintf_compat.h
@@ -6,41 +6,48 @@
* @brief Do not use, json-c internal, may be changed or removed at any time.
*/
#include "snprintf_compat.h"
+#ifndef WIN32
+#include <stdarg.h>
+#endif /* !defined(WIN32) */
+#include <stdint.h>
#include <stdlib.h>
#if !defined(HAVE_VASPRINTF)
/* CAW: compliant version of vasprintf */
static int vasprintf(char **buf, const char *fmt, va_list ap)
{
#ifndef WIN32
static char _T_emptybuffer = '\0';
+ va_list ap2;
#endif /* !defined(WIN32) */
int chars;
char *b;
if (!buf)
{
return -1;
}
#ifdef WIN32
- chars = _vscprintf(fmt, ap) + 1;
+ chars = _vscprintf(fmt, ap);
#else /* !defined(WIN32) */
/* CAW: RAWR! We have to hope to god here that vsnprintf doesn't overwrite
- * our buffer like on some 64bit sun systems.... but hey, its time to move on
+ * our buffer like on some 64bit sun systems... but hey, it's time to move on
*/
- chars = vsnprintf(&_T_emptybuffer, 0, fmt, ap) + 1;
- if (chars < 0)
+ va_copy(ap2, ap);
+ chars = vsnprintf(&_T_emptybuffer, 0, fmt, ap2);
+ va_end(ap2);
+#endif /* defined(WIN32) */
+ if (chars < 0 || (size_t)chars + 1 > SIZE_MAX / sizeof(char))
{
- chars *= -1;
- } /* CAW: old glibc versions have this problem */
-#endif /* defined(WIN32) */
+ return -1;
+ }
- b = (char *)malloc(sizeof(char) * chars);
+ b = (char *)malloc(sizeof(char) * ((size_t)chars + 1));
if (!b)
{
return -1;
}