| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | |
| | |
| | |
| | | |
Avoids undefined behavior. Found by autofuzz.
|
|/ /
| |
| |
| |
| | |
2.replace json_object_get/put API with json_object_retain/release, as they operate the reference counter, and confused with array_list_get/put_idx.
3.replace array_list_get/put_idx API with array_list_get/insert to make them more clear to use.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If we want to override `strerror()` in libjson-c
to make tests consistent across platforms, we
need to do it build-wide as configure/build
option.
Apple linkers make it really hard to override functions
at link-time, and this seems to be locked down on travis-ci.org
[ for security reasons I assume ].
While I got it to work locally, it did not work
when running on travis.
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
|
| |
| |
| |
| | |
older compilers.
|
| |
| |
| |
| | |
CentOS w/ gcc 4.1.2).
|
| |
| |
| |
| | |
PR #331.
|
| |
| |
| |
| | |
thread safety issues. Suggested by @rouault in PR #331.
|
| | |
|
| |
| |
| |
| | |
*library-wide* format for how doubles are written to a serialized JSON output.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Issue originally found in the json-c 0.11 internal copy in GDAL but also found
in latest git version.
If doing things like
json_object* obj = json_object_new_double(1e300);
json_object_set_serializer(obj, json_object_double_to_json_string, "%f", NULL);
json_object_to_json_string(obj)
size = snprintf(buf, sizeof(buf),
format ? format :
(modf(jso->o.c_double, &dummy) == 0) ? "%.17g.0" : "%.17g",
jso->o.c_double);
will return a value greater than 128 since at least 300 characters are needed.
This value is then passed to printbuf_memappend(pb, buf, size); that tries to
read size bytes in buf.
So we should clamp size to sizeof(buf). And on Windows, _snprintf() returns -1
in that situation, so deal also with this case.
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1682
Credit to OSS-Fuzz
|
| |
| |
| |
| | |
'PRId64'; literal operator or literal operator template 'operator ""PRId64' not found
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Hawciz pointed out that the previous commit modifies the public
interface of printbuf. Per his suggestion, sprintbuf() was restored
and a new pair of macros was added that wraps printbuf_memappend().
Using a wrapper macro instead of modifying sprintbuf() also reduces
function call overhead, bringing total performance gains to
approximately 400%.
|
| |
| |
| |
| | |
Removes variadic prints for ~3x performance improvement.
|
| |
| |
| |
| | |
closes https://github.com/json-c/json-c/issues/278
|
| |
| |
| |
| | |
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This reverts commit aaba8c1080533133329086e47f4f45981dfdd1ee.
This commit breaks builddir != srcdir build, but, more importantly, it
also adds a dependency on a header, "config.h", which is not installed
and it's supposed to be private — since it's generated at configuration
time and it's not meant to be used by projects compiling against a
library.
|
| |
| |
| |
| | |
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
|
| |
| |
| |
| | |
abort in json_object_set_userdata() since we can't actually do anything with the userdata.
|
| |
| |
| |
| | |
appropriate type.
|
|\ \
| | |
| | | |
Json object set xxx
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
|/ / |
|
| |
| |
| |
| | |
though it is up to the callers to avoid doing so in more complex cases.
|
| |
| |
| |
| |
| |
| | |
json_object_object_add(), and been changed to return int at the same time the latter was. Do that now.
Also correct a couple of calls to _to_json_string to check the return value.
|
| |
| |
| |
| |
| |
| |
| |
| | |
always return NULL. (Issue #259)
Also undo NULL check in json_tokener_set_flags(): it's not at all valid toi
try to set flags on a NULL pointer, and doing so should not be silently
ignored.
|
|\ \
| | |
| | | |
Minor changes in C source code
|
| | | |
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This new method allows to also
get the length of the generated string.
Fix #165
Change-Id: Iea91404027f143ca3d29a4c58d7c07ae53556110
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
|
| |
| |
| |
| |
| | |
To better distinguish between entry->k and entry->v being const within linkhash, but non-const outside, add lh_entry_v() and lh_entry_k() accessors.
Make lh_entry->k const.
|
| |
| |
| |
| |
| | |
Also, json_object_set_serializer is changed to respect the userdata
and user_delete parameters when to_string_func is NULL.
|
| |
| |
| |
| |
| |
| |
| |
| | |
The user might want to use the userdata for something different, so the
serializer should ignore it by default.
Explicitly setting the serializer to json_object_double_to_json_string will
still make it interpret the userdata as a format string.
|
| |
| |
| |
| | |
updating the range checks to use a calculated SIZE_T_MAX.
|
|\ \
| | |
| | |
| | | |
into doctaweeks-fixes-for-upstream
|
| |/ |
|
| | |
|
|\ \
| | |
| | |
| | | |
Protovision-master
|
| | | |
|
|\ \ \
| | | |
| | | | |
Fix various potential null ptr deref and int32 overflows
|
| | | |
| | | |
| | | |
| | | |
| | | | |
This fix errors that can happen when ingesting very large JSON files
when hitting the maximum heap size of the process.
|
|\ \ \ \
| | | | |
| | | | | |
Add utility function for comparing json_objects
|
| |/ / / |
|
|/ / /
| | |
| | |
| | | |
Tests added.
|
| | | |
|
|\ \ \ |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
* Return value of json_object_object_add() changed from void to int.
Return value now indicates success or failure.
* Check whether allocations are successful.
* Do not exit program from within the library.
|