Petri Lehtinen
aed855e692
Avoid invalid memory read in json_pack()
...
Initial patch by @bharjoc-bitdefender
Fixes #421
2018-07-09 22:26:35 +03:00
Petri Lehtinen
b59ac57617
Merge pull request #415 from palmerc/master
...
CMake variable to number comparison changed to provide meaningful error
2018-05-22 07:38:17 +03:00
Cameron Lowell Palmer
904f5c28ac
CMake variable to number comparison changed to provide meaningful error
...
message. Explicitly specify STATIC and PIC
2018-05-18 10:35:05 +02:00
Petri Lehtinen
80cea73bf9
Merge pull request #408 from isaachier/cmake
...
CMake improvements, make package relocatable
2018-05-18 08:08:32 +03:00
Petri Lehtinen
e28bcfeac8
Merge pull request #417 from akheron/visual-studio-15
...
Appveyor & build instructions for Visual Studio 15 2017
2018-05-07 14:22:03 +03:00
Petri Lehtinen
fda9288b5f
Update build instructions for Visual Studio
2018-05-07 11:17:08 +03:00
Petri Lehtinen
9ff08f6312
Also build with VS 2017 in appveyor
2018-05-07 08:39:49 +03:00
Petri Lehtinen
dd4743a51d
Merge pull request #412 from Mephistophiles/fix_defines
...
Fix JSON_HAVE_SYNC_BUILTINS define usage
2018-05-07 08:13:21 +03:00
Maxim Zhukov
50f29f9b1a
Add JSON_HAVE_SYNC_BUILTINS and JSON_HAVE_ATOMIC_BUILTINS for autoheader
...
Added JSON_HAVE_SYNC_BUILTINS and JSON_HAVE_ATOMIC_BUILTINS defines to
jansson_config.h.cmake as well as in the autoheader for autoconf.
2018-03-22 17:46:29 +03:00
Petri Lehtinen
e5dbe7bb64
Merge pull request #409 from Mephistophiles/master
...
Fix error handling in json_pack
2018-03-22 10:40:41 +02:00
Maxim Zhukov
15105b66b4
Fix error handling in json_pack
...
Fixed a bug where the error message was not filled if an empty object
was passed to the json_pack.
Fixes #271
2018-03-22 11:16:40 +03:00
Petri Lehtinen
b23025d72b
Merge pull request #404 from coreyfarrell/func-attrs
...
Build: Add JANSSON_ATTRS macro.
2018-03-20 04:55:48 +02:00
Isaac Hier
2c98c30a02
Stop using absolute paths
2018-03-11 10:54:24 -04:00
Isaac Hier
bb71db204f
Fix output file name for version config
2018-03-11 10:54:14 -04:00
Isaac Hier
92760bb363
Remove warning
2018-03-11 10:54:02 -04:00
Isaac Hier
fe7873e963
Fix package version config generation
2018-03-11 10:37:15 -04:00
Isaac Hier
a586c0654f
Fix CMake include
2018-03-11 10:27:48 -04:00
Isaac Hier
6d7a02beb0
Clean up CMake install
2018-03-11 10:24:27 -04:00
Isaac Hier
b70364b362
Remove absolute path references
2018-03-11 10:11:09 -04:00
Isaac Hier
6d1ae86e1c
Fix config file
2018-03-11 09:59:52 -04:00
Isaac Hier
a324d18940
Rename target file
2018-03-11 09:53:06 -04:00
Isaac Hier
44f6606df8
Rename config files
2018-03-11 09:47:29 -04:00
Isaac Hier
d8798468c6
Upgrade CMake to 3.1 for Hunter
2018-03-11 09:34:45 -04:00
Corey Farrell
749bef0b6a
More test coverage.
...
* Add test_load_callback to CMakeList.txt
* Add json_dump, json_load and json_unpack chaos testing.
2018-03-06 23:28:14 -05:00
Corey Farrell
e37e52549f
Add warn_unused_result to strbuffer_init.
...
This adds a compiler warning when strbuffer_init return value is
ignored. unpack_object is updated to deal with errors produced
while building unrecognized_keys.
2018-03-06 08:27:20 -05:00
Corey Farrell
ea664722d4
Build: Add JANSSON_ATTRS macro.
...
This macro is used to conditionally generate GCC/CLANG __attribute__
declarations if supported.
This allows the compiler to produce warnings on certain incorrect
usages. json_sprintf and json_vsprintf will produce warnings on invalid
format string. Many functions will produce a warning if the result is
unused. Specifically functions which allocate new objects will warn if
the result is ignored as this always results in a memory leak.
2018-03-06 07:25:16 -05:00
Petri Lehtinen
d098c0ff86
Merge pull request #400 from coreyfarrell/branch-coverage
...
Enable branch coverage reporting.
2018-02-20 15:39:36 +02:00
Petri Lehtinen
2d494c169f
Merge pull request #398 from coreyfarrell/test-coverage
...
Improve test coverage.
2018-02-20 15:39:19 +02:00
Corey Farrell
a5af280bac
Enable branch coverage reporting.
2018-02-20 03:09:03 -05:00
Corey Farrell
73c22de516
Improve test coverage.
...
* Test equality of different length strings.
* Add tab to json_pack whitespace test.
* Test json_sprintf with empty result and invalid UTF.
* Test json_get_alloc_funcs with NULL arguments.
* Test invalid arguments.
* Add test_chaos to test allocation failure code paths.
* Remove redundant json_is_string checks from json_string_equal and
json_string_copy. Both functions are static and can only be called
with a json string.
Fixes to issues found by test_chaos:
* Fix crash on OOM in pack_unpack.c:read_string().
* Unconditionally free string in string_create upon allocation failure.
Update load.c:parse_value() to reflect this. This resolves a leak on
allocation failure for pack_unpack.c:pack_string() and
value.c:json_sprintf().
Although not visible from CodeCoverage these changes significantly
increase branch coverage. Especially in src/value.c where we previously
covered 67.4% of branches and now cover 96.3% of branches.
2018-02-15 10:12:31 -05:00
Petri Lehtinen
6dddf687d8
Merge pull request #396 from coreyfarrell/2.11
...
jansson 2.11
2018-02-11 20:11:41 +02:00
Corey Farrell
744fe5ed44
jansson 2.11
2018-02-09 12:31:18 -05:00
Petri Lehtinen
03620980cf
Merge pull request #395 from akheron/doc-utf-8
...
Document encoding requirements for callbacks
2018-02-09 10:10:34 +02:00
Petri Lehtinen
248d62111c
Merge pull request #368 from AmeyaVS/cmake_build_fix
...
Fix generated `pkg-config` file using cmake.
2018-02-09 09:45:36 +02:00
Petri Lehtinen
46dff2737d
Merge pull request #381 from phst/end-of-file-error-code
...
Use a more specific error code for premature end of input
2018-02-09 09:40:42 +02:00
Petri Lehtinen
fa0b5ece9e
Merge pull request #380 from phst/doc-error-code
...
document that json_error_code will be added in version 2.11
2018-02-09 09:39:38 +02:00
Petri Lehtinen
a6138a07b6
Document encoding requirements for callbacks
...
Original patch by @phst.
Fixes #369 .
2018-02-09 09:35:53 +02:00
Petri Lehtinen
2863dde053
Merge pull request #393 from akheron/json_sprintf
...
Add json_sprintf and json_vsprintf
2018-02-09 08:15:16 +02:00
Petri Lehtinen
efe6c7b3f2
Add json_sprintf and json_vsprintf
...
Fixes #392
2018-02-09 07:37:33 +02:00
Petri Lehtinen
3e81f78366
Merge pull request #389 from coreyfarrell/threadsafety
...
Atomic references and thread safe json_dump
2018-02-08 20:19:07 +02:00
Corey Farrell
8104ce167a
Merge pull request #1 from akheron/threadsafety
...
Clarify thread safety docs, rename JANSSON_THREAD_SAFE
2018-02-08 11:58:30 -05:00
Petri Lehtinen
f44921e176
Clarify thread safety docs, rename JANSSON_THREAD_SAFE
2018-02-08 12:38:14 +02:00
Corey Farrell
3aee856d7b
Docs: Update information on thread safety.
...
Fixes #387
2018-02-01 15:54:35 -05:00
Corey Farrell
37e0ee4d48
json_dump: Fix thread safety issue.
...
Circular reference detection in json_dump was not thread safe. Replace
visited flag with a hashtable_t.
Issue #387
2018-02-01 15:54:25 -05:00
Corey Farrell
dc3b313e91
Use thread-safe reference counting if supported by the compiler.
...
This makes use of __atomic or __sync builtin compiler functions to make
json_decref and json_incref thread-safe.
Issue #387
2018-01-29 14:17:58 -05:00
Philipp Stephani
45228cada4
Use a more specific error code for premature end of input
2017-12-20 18:27:04 +01:00
Philipp Stephani
24d45272a7
document that json_error_code will be added in version 2.11
2017-12-18 23:51:32 +01:00
Petri Lehtinen
9e5af7c3b7
Merge pull request #374 from coreyfarrell/always-steal
...
json_pack: Enable more complete stealing of references.
2017-12-16 20:35:14 +02:00
Corey Farrell
6c78910011
apiref: Clarify documentation for unpack O
format.
...
The `O` format causes reference counts to increase, but in an error they
are not released. Callers to unpack functions that use the `O` format
should use pointers pre-initialized to NULL so they can safely release
the reference on error.
Also corrected typo which said this was like `O` (itself).
Fixes #135
2017-12-13 14:04:07 -05:00
Corey Farrell
89dad8959b
json_object_iter_set_new: Fix error branch leak.
...
This function needs to release a reference to value if the other
arguments are invalid.
Issue #135
2017-12-13 14:04:07 -05:00