Compare commits

...

3 Commits

Author SHA1 Message Date
Eli Schwartz 447b5e98a3
Merge bfbed6434d into 87d8f0961a 2024-02-13 21:40:19 +04:00
Alanscut 87d8f0961a Release 1.7.17
update version to 1.7.17
2023-12-26 10:24:36 +08:00
Eli Schwartz bfbed6434d
simplify the use of *nix symbol exports
It is generally never wrong to avoid setting the symbol visibility to
default for public symbols. It is already checked for compilers that
actually support the attribute.

The visibility define merely tells the compiler that the symbol is
semantically an interface symbol. This is already the default for all
symbols. The real purpose of the attribute is simply to override
-fvisibility passed on the command line.

On *nix, you can set visibility for both shared and static libraries
without harm anyway.

Despite this, respect the "hidden symbols" option. There's no actual use
for creating a shared library without symbols, and it's essentially a
no-op for static libraries, but in the static library case one might be
including cJSON into another shared library, and not want to expose the
cJSON symbols.

Therefore, make the header *directly* respect this option, rather than
conditionalizing it on the CMakeLists.txt both setting the hidden
symbols define *and* undefining the visibility define.
2022-07-01 00:05:09 -04:00
5 changed files with 14 additions and 9 deletions

View File

@ -1,3 +1,10 @@
1.7.17 (Dec 26, 2023)
======
Fixes:
------
* Fix null reference in cJSON_SetValuestring(CVE-2023-50472), see #809
* Fix null reference in cJSON_InsertItemInArray(CVE-2023-50471), see #809 and #810
1.7.16 (Jul 5, 2023)
======
Features:

View File

@ -2,7 +2,7 @@ set(CMAKE_LEGACY_CYGWIN_WIN32 0)
cmake_minimum_required(VERSION 3.0)
project(cJSON
VERSION 1.7.16
VERSION 1.7.17
LANGUAGES C)
cmake_policy(SET CMP0054 NEW) # set CMP0054 policy
@ -88,11 +88,11 @@ endif()
option(ENABLE_PUBLIC_SYMBOLS "Export library symbols." On)
if (ENABLE_PUBLIC_SYMBOLS)
list(APPEND custom_compiler_flags -fvisibility=hidden)
add_definitions(-DCJSON_EXPORT_SYMBOLS -DCJSON_API_VISIBILITY)
add_definitions(-DCJSON_EXPORT_SYMBOLS)
endif()
option(ENABLE_HIDDEN_SYMBOLS "Hide library symbols." Off)
if (ENABLE_HIDDEN_SYMBOLS)
add_definitions(-DCJSON_HIDE_SYMBOLS -UCJSON_API_VISIBILITY)
add_definitions(-DCJSON_HIDE_SYMBOLS)
endif()
# apply custom compiler flags

View File

@ -8,7 +8,7 @@ CJSON_TEST_SRC = cJSON.c test.c
LDLIBS = -lm
LIBVERSION = 1.7.16
LIBVERSION = 1.7.17
CJSON_SOVERSION = 1
UTILS_SOVERSION = 1

View File

@ -117,7 +117,7 @@ CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item)
}
/* This is a safeguard to prevent copy-pasters from using incompatible C and header files */
#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 16)
#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 17)
#error cJSON.h and cJSON.c have different versions. Make sure that both have the same.
#endif

View File

@ -48,8 +48,6 @@ or
-xldscope=hidden (for sun cc)
to CFLAGS
then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does
*/
#define CJSON_CDECL __cdecl
@ -71,7 +69,7 @@ then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJ
#define CJSON_CDECL
#define CJSON_STDCALL
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY)
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && !defined(CJSON_HIDE_SYMBOLS)
#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type
#else
#define CJSON_PUBLIC(type) type
@ -81,7 +79,7 @@ then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJ
/* project version */
#define CJSON_VERSION_MAJOR 1
#define CJSON_VERSION_MINOR 7
#define CJSON_VERSION_PATCH 16
#define CJSON_VERSION_PATCH 17
#include <stddef.h>