Compare commits

...

6 Commits

Author SHA1 Message Date
Takatoshi Kondo
3bdbf0d2ee Merge pull request #973 from redboltz/update_to_402
Updated the version to 4.0.2.
2021-08-31 10:06:48 +09:00
Takatoshi Kondo
d8324b58e9 Updated the version to 4.0.2. 2021-08-31 09:33:01 +09:00
Takatoshi Kondo
c0708dbcba Merge pull request #972 from kovdan01/fix_fuzz_running
Fix #969
2021-08-31 09:24:20 +09:00
Takatoshi Kondo
5dc0a904de Merge pull request #971 from kovdan01/add_boost_test_dyn_link
Add `MSGPACK_USE_STATIC_BOOST` cmake option (fix #970)
2021-08-31 09:07:53 +09:00
Daniil Kovalev
4ed6b45abd Add MSGPACK_USE_STATIC_BOOST cmake option 2021-08-30 23:01:49 +03:00
Daniil Kovalev
4ea4d69123 Fix #969 2021-08-30 21:45:50 +03:00
12 changed files with 76 additions and 47 deletions

View File

@@ -1,3 +1,7 @@
# 2021-08-31 version 4.0.2 for C++
* Fix fuzzer interface function name (#972)
* Fix boost test link error and support both dynamin(default) and static link boost (#971)
# 2021-08-30 version 4.0.1 for C++ # 2021-08-30 version 4.0.1 for C++
* Fix release tarball and its generation script (#967) * Fix release tarball and its generation script (#967)

View File

@@ -21,12 +21,14 @@ OPTION (MSGPACK_CXX14 "Using c++14 compiler" OFF)
OPTION (MSGPACK_CXX17 "Using c++17 compiler" OFF) OPTION (MSGPACK_CXX17 "Using c++17 compiler" OFF)
OPTION (MSGPACK_CXX20 "Using c++20 compiler" OFF) OPTION (MSGPACK_CXX20 "Using c++20 compiler" OFF)
OPTION (MSGPACK_32BIT "32bit compile" OFF) OPTION (MSGPACK_32BIT "32bit compile" OFF)
OPTION (MSGPACK_USE_X3_PARSE "Use Boost X3 parse" OFF) OPTION (MSGPACK_USE_X3_PARSE "Use Boost X3 parse" OFF)
OPTION (MSGPACK_BUILD_TESTS "Build tests" OFF) OPTION (MSGPACK_BUILD_TESTS "Build tests" OFF)
OPTION (MSGPACK_FUZZ_REGRESSION "Enable regression testing" OFF) OPTION (MSGPACK_FUZZ_REGRESSION "Enable regression testing" OFF)
OPTION (MSGPACK_BUILD_EXAMPLES "Build msgpack examples" OFF) OPTION (MSGPACK_BUILD_EXAMPLES "Build msgpack examples" OFF)
OPTION (MSGPACK_GEN_COVERAGE "Generate coverage report" OFF) OPTION (MSGPACK_GEN_COVERAGE "Generate coverage report" OFF)
OPTION (MSGPACK_USE_STATIC_BOOST "Statically link with boost libraries" OFF)
OPTION (MSGPACK_CHAR_SIGN "Char sign to use (signed or unsigned)")
SET (CMAKE_CXX_STANDARD_REQUIRED ON) SET (CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -59,8 +61,15 @@ IF (MSGPACK_32BIT)
ENDIF () ENDIF ()
ENDIF () ENDIF ()
SET (Boost_USE_MULTITHREADED ON) SET (Boost_USE_MULTITHREADED ON)
SET (Boost_USE_STATIC_RUNTIME OFF)
IF (MSGPACK_USE_STATIC_BOOST)
MESSAGE (STATUS "Staticly linking with Boost")
SET (Boost_USE_STATIC_LIBS TRUE)
ELSE ()
MESSAGE (STATUS "Dynamically linking with Boost")
SET (Boost_USE_STATIC_LIBS FALSE)
ENDIF ()
IF (MSGPACK_CHAR_SIGN) IF (MSGPACK_CHAR_SIGN)
SET (CMAKE_CXX_FLAGS "-f${MSGPACK_CHAR_SIGN}-char ${CMAKE_CXX_FLAGS}") SET (CMAKE_CXX_FLAGS "-f${MSGPACK_CHAR_SIGN}-char ${CMAKE_CXX_FLAGS}")
@@ -69,6 +78,7 @@ ENDIF ()
IF (MSGPACK_DEFAULT_API_VERSION) IF (MSGPACK_DEFAULT_API_VERSION)
SET (CMAKE_CXX_FLAGS "-DMSGPACK_DEFAULT_API_VERSION=${MSGPACK_DEFAULT_API_VERSION} ${CMAKE_CXX_FLAGS}") SET (CMAKE_CXX_FLAGS "-DMSGPACK_DEFAULT_API_VERSION=${MSGPACK_DEFAULT_API_VERSION} ${CMAKE_CXX_FLAGS}")
ELSE () ELSE ()
SET (MSGPACK_DEFAULT_API_VERSION 3)
SET (CMAKE_CXX_FLAGS "-DMSGPACK_DEFAULT_API_VERSION=3 ${CMAKE_CXX_FLAGS}") SET (CMAKE_CXX_FLAGS "-DMSGPACK_DEFAULT_API_VERSION=3 ${CMAKE_CXX_FLAGS}")
ENDIF () ENDIF ()

View File

@@ -1,7 +1,7 @@
`msgpack` for C++ `msgpack` for C++
=================== ===================
Version 4.0.1 [![Build Status](https://github.com/msgpack/msgpack-c/workflows/CI/badge.svg?branch=cpp_master)](https://github.com/msgpack/msgpack-c/actions) [![Build status](https://ci.appveyor.com/api/projects/status/8kstcgt79qj123mw/branch/cpp_master?svg=true)](https://ci.appveyor.com/project/redboltz/msgpack-c/branch/cpp_master) Version 4.0.2 [![Build Status](https://github.com/msgpack/msgpack-c/workflows/CI/badge.svg?branch=cpp_master)](https://github.com/msgpack/msgpack-c/actions) [![Build status](https://ci.appveyor.com/api/projects/status/8kstcgt79qj123mw/branch/cpp_master?svg=true)](https://ci.appveyor.com/project/redboltz/msgpack-c/branch/cpp_master)
[![codecov](https://codecov.io/gh/msgpack/msgpack-c/branch/cpp_master/graph/badge.svg)](https://codecov.io/gh/msgpack/msgpack-c/branch/cpp_master) [![codecov](https://codecov.io/gh/msgpack/msgpack-c/branch/cpp_master/graph/badge.svg)](https://codecov.io/gh/msgpack/msgpack-c/branch/cpp_master)
It's like JSON but smaller and faster. It's like JSON but smaller and faster.
@@ -153,6 +153,8 @@ Other useful options:
- `MSGPACK_32BIT` (default `OFF`): 32bit compile - `MSGPACK_32BIT` (default `OFF`): 32bit compile
- `MSGPACK_USE_X3_PARSE` (default `OFF`): use Boost X3 parse - `MSGPACK_USE_X3_PARSE` (default `OFF`): use Boost X3 parse
(note that it requires C++14 or newer) (note that it requires C++14 or newer)
- `MSGPACK_CHAR_SIGN` (not set explicitly by default): char sign to use (signed or unsigned)
- `MSGPACK_USE_STATIC_BOOST` (default `OFF`): statically link with boost libraries
#### GUI on Windows #### GUI on Windows

View File

@@ -1,4 +1,4 @@
version: 4.0.1.{build} version: 4.0.2.{build}
branches: branches:
only: only:

View File

@@ -4,52 +4,52 @@ FIND_PROGRAM(LCOV_PATH lcov)
FIND_PROGRAM(GENHTML_PATH genhtml) FIND_PROGRAM(GENHTML_PATH genhtml)
IF(NOT GCOV_PATH) IF(NOT GCOV_PATH)
MESSAGE(FATAL_ERROR "gcov not found! Aborting...") MESSAGE(FATAL_ERROR "gcov not found! Aborting...")
ENDIF() ENDIF()
IF(NOT CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_COMPILER_IS_GNUCXX) IF(NOT CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_COMPILER_IS_GNUCXX)
# Clang version 3.0.0 and greater now supports gcov as well. # Clang version 3.0.0 and greater now supports gcov as well.
MESSAGE(STATUS "Compiler is not GNU gcc! Clang Version 3.0.0 and greater supports gcov as well, but older versions don't.") MESSAGE(STATUS "Compiler is not GNU gcc! Clang Version 3.0.0 and greater supports gcov as well, but older versions don't.")
IF(NOT "${CMAKE_C_COMPILER_ID}" MATCHES "Clang" AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") IF(NOT "${CMAKE_C_COMPILER_ID}" MATCHES "Clang" AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...") MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
ENDIF() ENDIF()
ENDIF() ENDIF()
SET(COVERAGE_FLAGS "-g -O0 --coverage") SET(COVERAGE_FLAGS "-g -O0 --coverage")
FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname) FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname)
IF(NOT LCOV_PATH) IF(NOT LCOV_PATH)
MESSAGE(FATAL_ERROR "lcov not found! Aborting...") MESSAGE(FATAL_ERROR "lcov not found! Aborting...")
ENDIF() ENDIF()
IF(NOT GENHTML_PATH) IF(NOT GENHTML_PATH)
MESSAGE(FATAL_ERROR "genhtml not found! Aborting...") MESSAGE(FATAL_ERROR "genhtml not found! Aborting...")
ENDIF() ENDIF()
# Setup target # Setup target
ADD_CUSTOM_TARGET(${_targetname} ADD_CUSTOM_TARGET(${_targetname}
# Cleanup lcov # Cleanup lcov
${LCOV_PATH} --directory . --zerocounters ${LCOV_PATH} --directory . --zerocounters
# Run tests # Run tests
COMMAND ${_testrunner} ${ARGV3} COMMAND ${_testrunner} ${ARGV3}
# Capturing lcov counters and generating report # Capturing lcov counters and generating report
COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info --base-directory ${CMAKE_SOURCE_DIR} --no-external --quiet COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info --base-directory ${CMAKE_SOURCE_DIR} --no-external --quiet
COMMAND ${LCOV_PATH} --remove ${_outputname}.info '*/test/*' '*/fuzz/*' --output-file ${_outputname}.info.cleaned --quiet COMMAND ${LCOV_PATH} --remove ${_outputname}.info '*/test/*' '*/fuzz/*' --output-file ${_outputname}.info.cleaned --quiet
COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned --prefix ${CMAKE_SOURCE_DIR} COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned --prefix ${CMAKE_SOURCE_DIR}
# COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned # COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report." COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
) )
# Show info where to find the report # Show info where to find the report
ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD
COMMAND ; COMMAND ;
COMMENT "Open ./${_outputname}/index.html in your browser to view the coverage report." COMMENT "Open ./${_outputname}/index.html in your browser to view the coverage report."
) )
ENDFUNCTION() ENDFUNCTION()

View File

@@ -1,5 +1,5 @@
IF (MSGPACK_USE_X3_PARSE AND MSGPACK_DEFAULT_API_VERSION VERSION_GREATER 1) IF (MSGPACK_USE_X3_PARSE AND MSGPACK_DEFAULT_API_VERSION VERSION_GREATER 1)
FIND_PACKAGE (Boost REQUIRED COMPONENTS context system unit_test_framework) FIND_PACKAGE (Boost REQUIRED COMPONENTS context system)
FIND_PACKAGE (Threads REQUIRED) FIND_PACKAGE (Threads REQUIRED)
LIST (APPEND exec_PROGRAMS LIST (APPEND exec_PROGRAMS
@@ -43,7 +43,6 @@ IF (MSGPACK_USE_X3_PARSE AND MSGPACK_DEFAULT_API_VERSION VERSION_GREATER 1)
msgpackc-cxx msgpackc-cxx
Boost::context Boost::context
Boost::system Boost::system
Boost::unit_test_framework
Threads::Threads Threads::Threads
) )
IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")

View File

@@ -11,6 +11,10 @@ FOREACH (source_file ${check_PROGRAMS})
${source_file_we} ${source_file_we}
${source_file} ${source_file}
) )
TARGET_COMPILE_DEFINITIONS (${source_file_we} PRIVATE
$<IF:$<BOOL:${MSGPACK_USE_STATIC_BOOST}>,,BOOST_TEST_DYN_LINK>)
TARGET_LINK_LIBRARIES (${source_file_we} TARGET_LINK_LIBRARIES (${source_file_we}
msgpackc-cxx msgpackc-cxx
Threads::Threads Threads::Threads
@@ -18,7 +22,9 @@ FOREACH (source_file ${check_PROGRAMS})
Boost::system Boost::system
Boost::unit_test_framework Boost::unit_test_framework
) )
ADD_TEST (${source_file_we} ${source_file_we}) ADD_TEST (${source_file_we} ${source_file_we})
IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Wno-mismatched-tags -g") SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Wno-mismatched-tags -g")
IF ("${MSGPACK_SAN}" STREQUAL "ASAN") IF ("${MSGPACK_SAN}" STREQUAL "ASAN")

View File

@@ -38,7 +38,7 @@ void UnpackPackFuzzerRegressionTest(const std::string& fpath) {
std::vector<char> bytes(length); std::vector<char> bytes(length);
in.read(bytes.data(), bytes.size()); in.read(bytes.data(), bytes.size());
BOOST_REQUIRE(in); BOOST_REQUIRE(in);
BOOST_REQUIRE_EQUAL(0, FuzzerTestOneInput(reinterpret_cast<const uint8_t *>(bytes.data()), bytes.size())); BOOST_REQUIRE_EQUAL(0, LLVMFuzzerTestOneInput(reinterpret_cast<const uint8_t *>(bytes.data()), bytes.size()));
} }
boost::unit_test::test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[]) boost::unit_test::test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[])

View File

@@ -1,6 +1,10 @@
#include <msgpack.hpp> #include <msgpack.hpp>
extern "C" int FuzzerTestOneInput(const uint8_t *data, size_t size) { // The function's signature must NOT be changed since other projects rely on it:
// - libFuzzer
// - AFL++
// - Google's oss-fuzz (uses the previous two ones)
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
try { try {
// NOTE(derwolfe): by default the limits are set at 2^32-1 length. I'm // NOTE(derwolfe): by default the limits are set at 2^32-1 length. I'm
// setting these at far smaller values to avoid OOMs // setting these at far smaller values to avoid OOMs

View File

@@ -1,3 +1,3 @@
#define MSGPACK_VERSION_MAJOR 4 #define MSGPACK_VERSION_MAJOR 4
#define MSGPACK_VERSION_MINOR 0 #define MSGPACK_VERSION_MINOR 0
#define MSGPACK_VERSION_REVISION 1 #define MSGPACK_VERSION_REVISION 2

View File

@@ -74,6 +74,9 @@ FOREACH (source_file ${check_PROGRAMS})
${source_file} ${source_file}
) )
TARGET_COMPILE_DEFINITIONS (${source_file_we} PRIVATE
$<IF:$<BOOL:${MSGPACK_USE_STATIC_BOOST}>,,BOOST_TEST_DYN_LINK>)
TARGET_LINK_LIBRARIES (${source_file_we} TARGET_LINK_LIBRARIES (${source_file_we}
msgpackc-cxx msgpackc-cxx
Boost::system Boost::system
@@ -81,6 +84,7 @@ FOREACH (source_file ${check_PROGRAMS})
Threads::Threads Threads::Threads
ZLIB::ZLIB ZLIB::ZLIB
) )
ADD_TEST (NAME ${source_file_we} COMMAND ${source_file_we}) ADD_TEST (NAME ${source_file_we} COMMAND ${source_file_we})
IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")

View File

@@ -5,5 +5,5 @@
BOOST_AUTO_TEST_CASE(works) BOOST_AUTO_TEST_CASE(works)
{ {
BOOST_CHECK_EQUAL(0, FuzzerTestOneInput(MSGPACK_NULLPTR, 0)); BOOST_CHECK_EQUAL(0, LLVMFuzzerTestOneInput(MSGPACK_NULLPTR, 0));
} }