435 Commits

Author SHA1 Message Date
Takatoshi Kondo
01f3d24fee Unify all package related names to msgpack-c.
Update the version to 6.0.0.
2023-02-28 10:49:13 +09:00
Takatoshi Kondo
bffd3f2091 Updated the version to 5.0.0. 2023-01-10 18:50:20 +09:00
Takatoshi Kondo
e96853a946 Updated the version to 4.0.0. 2021-09-01 10:50:27 +09:00
Jessica Clarke
823caa8d8c Increase portability by masking rather than dividing and multiplying pointers
If (u)intptr_t exist, the only guarantee provided by the C standard is
that you can cast a pointer to one and back. No claims are made about
what that injective pointer-to-integer mapping is, nor the surjective
reverse integer-to-pointer mapping; for example, nowhere is it specified
that, given a char *p, p + 1 == (char *)((uintptr_t)p + 1), although no
sensible implementation would make that not the case (provided p is a
valid strictly in bounds pointer).

With real pointers, taking them out of bounds (other than the one
exception that is a one-past-the-end pointer) of their corresponding
allocation is UB. Whilst the semantics of arithmetic on uintptr_t is not
specified when cast back to a pointer, compilers already assume that
uintptr_t arithmetic does not go out of bounds (or, put another way,
that the result always ends up pointing to the same allocation) and
their alias analysis-based optimisations already assume this. CHERI, and
Arm's Morello, implement C language pointers with hardware capabilities,
which are unforgeable pointers with bounds and permissions. In order to
only double rather than quadruple the size of pointers, CHERI exploits
C's requirement that pointers not be taken out of bounds, and compresses
these bounds using a floating-point-like representation. The important
implication of this for most software is that if a capability, i.e. C
pointer in CHERI C, is taken too far out of bounds (where "too far" is
proportional to the size of the allocation) it can no longer be
represented and thus is invalidated, meaning it will trap on a later
dereference. This also extends to (u)intptr_t, which are also
implemented as capabilities, since if it were just a plain integer then
casting a pointer to (u)intptr_t would lose the metadata and break the
ability to cast back to a pointer.

Whilst the composition of dividing a pointer and then multiplying it
again has a somewhat sensible interpretation of rounding it down (even
though technically no such guarantees are made by the spec), the
individual operations do not, and the division is highly likely to take
the pointer far out of bounds of its allocation and, on CHERI, result in
it being unrepresentable and thus invalidated. Instead, we can perform a
more standard bitwise AND with a mask to clear the low bits, exploiting
the fact that alignments are powers of two; note that technically the
rounding up variant of this does take the pointer out of bounds slightly
and, whilst there are other ways to write such code that avoid doing so,
they are more cumbersome, and this code does not need to worry about
that.
2021-08-07 00:19:46 +01:00
Jessica Clarke
9c5654ed44 Increase portability by using uintptr_t rather than size_t for pointers
The only integral types guaranteed by the C standard, if they exist, to
support having a pointer cast to them and back are (u)intptr_t. On most
architectures, size_t and uintptr_t are typedefs for the same underlying
type, so this code ends up working. However, on CHERI, and thus Arm's
experimental Morello prototype, C language pointers are implemented with
hardware capabilities, which are unforgeable pointers with bounds and
permissions. This means that, whilst size_t remains a plain 32/64-bit
integer size, (u)intotr_t is represented with a capability. Casting to
size_t and back to a pointer causes the capability metadata to be lost
and the resulting capability to be invalid, meaning it will trap when
dereferenced. Instead, use uintptr_t, and provide fallback definitions
for old versions of MSVC like for the other C99 integer types.
2021-08-06 23:49:16 +01:00
Daniil Kovalev
0f1d0ed78c Fix name conflicts (C version)
Same as #952, but for C
2021-05-08 16:51:02 +03:00
Takatoshi Kondo
3bd0172a9a Unified NULL buf handling for all *buffer.
*buffer means sbuffer, zbuffer, fbuffer, and vrefbuffer.

The logic is as follows:

if buf is NULL
   if len is 0
      do nothing return 0 (success)
   else
      assertion fail
else
   set contants to *buffer
2020-07-03 09:18:00 +09:00
yuangongji
fd9e377bac check null pointer before using memcpy() 2020-07-01 16:39:40 +08:00
yuangongji
9c6857c425 rename pack_template.h and sysdep.h
include/msgpack/pack_template.h => cmake/pack_template.h.in
include/msgpack/sysdep.h => cmake/sysdep.h.in

Use `git log --follow cmake/filename.h.in` to see full log
2020-06-05 16:09:17 +08:00
yuangongji
ee546036a1 remove C++ part files
remove the following files or folders:
erb
example/boost
example/cpp03
example/cpp11
example/x3
example/CMakeLists.txt
fuzz
include/msgpack/adaptor
include/msgpack/predef.h
include/msgpack/predef
include/msgpack/preprocessor
include/msgpack/v1
include/msgpack/v2
include/msgpack/v3
include/msgpack/*.hpp
include/msgpack.hpp
.gitmodules
external
make_file_list.sh
msgpack_vc8.sln
msgpack_vc8.vcproj
preprocess
QUICKSTART-CPP.md
test/*.cpp exclude test/*_c.cpp
.github/depends/boost.sh
ci/build_regression.sh
2020-06-05 16:09:17 +08:00
Takatoshi Kondo
66fa561256 Update the version to 3.3.0. 2020-06-05 16:22:34 +09:00
yuangongji
403567c1c5 convert between msgpack and json 2020-05-24 17:24:55 +08:00
yuangongji
1a372058a6 Use C style casts instead of C++ style casts 2020-04-16 12:46:16 +08:00
Igor Sadchenko
9a3cd0c951 Fixed many warnings/errors with macro __GNUC__(issue #850) 2020-03-26 02:03:25 +03:00
Takatoshi Kondo
8dc865d92d Added github actions.
Fixed enum qualifier.
2019-12-23 16:54:14 +09:00
Takatoshi Kondo
b36e75a42e Updated the version to 3.2.1. 2019-12-10 12:44:07 +09:00
Torleiv Sundre
bf6cc035c7 Fix tests for MSVC <= 2013
Use the _TRUNCATE flag for the count parameter to _snprintf_s. Without
this, the tests for MSVC <= 2013 failed on stack corruption!
2019-12-04 20:10:42 +01:00
Josef Schlehofer
65c35caab2
Include <sys/uio.h> in Linux
This is needed when cross-compiling for OpenWrt.
2019-11-10 11:40:13 +01:00
Takatoshi Kondo
4b4eb83cd1 Fixed #805.
Fixed fwrite return value comparison.
2019-09-24 16:43:15 +09:00
probonopd
a123053823
Add "defined(__HAIKU__)", closes #796 2019-07-13 19:14:37 +00:00
Takatoshi Kondo
6954e01338 Fixed #794.
Buffer is expanded not only Z_OK, but also Z_BUF_ERROR case.
2019-07-12 21:55:50 +09:00
박진형2 [ungeziefer]
bae148bd76 Remove unnecessary lines from 'parse.hpp' 2019-07-10 19:54:29 +09:00
Takatoshi Kondo
7d994630d2 Replaced integer overflow with efficient way.
Same fix as #776 on C.
2019-07-07 18:13:31 +09:00
Takatoshi Kondo
ff77227e10 Updated the version to 3.2.0. 2019-05-27 18:37:24 +09:00
Wojciech Kaluza
41b2af8884 Fix self-including header 2019-05-22 20:38:36 +01:00
Takatoshi Kondo
d3fecce359 Added timespec support for C++11 or later. 2019-05-09 14:46:45 +09:00
RPG3D
a1b86507da
keep compatibility 2019-05-04 17:12:15 +08:00
RPG3D
9235d1acae
1.fix error on build msgpack with UE4 2019-05-02 14:57:15 +08:00
Takatoshi Kondo
6a08446b3d Removed noexcept overload. 2019-05-01 18:00:07 +09:00
Takatoshi Kondo
c93a42b5f4 Separate C++03 and 11. 2019-05-01 17:20:39 +09:00
Takatoshi Kondo
8febbfd9f5 Fixed noexcept. 2019-05-01 16:42:15 +09:00
Takatoshi Kondo
33a8d8c30f Added noexcept overload for C++11 and later. 2019-05-01 16:08:17 +09:00
Takatoshi Kondo
ef5bcadd95 Fixed #777.
Removed SFINAE. Use size type extractor.
2019-05-01 14:10:34 +09:00
Takatoshi Kondo
17267ed475 Added -Wconversion support for C++. 2019-03-25 19:48:39 +09:00
Takatoshi Kondo
f72372314e Fixed #763.
Fixed aligned_zone_size_visitor size passing.
Replaced by value with by reference.
2019-02-12 12:53:07 +09:00
Petr Benes
09e06a8cb7 Add support for Windows Drivers 2019-01-17 17:44:57 +01:00
Takatoshi Kondo
709d6f4fdd Fixed #754.
Fixed `msgpack::object` packing visitor and equal comparison visitor.

NOTE:
In the function `visit_ext(const char* v, uint32_t size)`, v contains
type and size means buffer `v` size. See #175.
2019-01-05 09:41:58 +09:00
Takatoshi Kondo
4f9ec65713 Fixed #741.
Fixed msgpack::type::tuple base class conversion.
Fixed C++03 msgpack::type::make_tuple.
2018-10-16 22:42:50 +09:00
Takatoshi Kondo
1155babda8 Added wstring adaptor. 2018-09-12 16:17:14 +09:00
Takatoshi Kondo
83a82e3eb5
Merge pull request #727 from redboltz/update_311
Updated the version to 3.1.1.
2018-09-09 15:27:47 +09:00
Takatoshi Kondo
f6ddc9b85a Added enforcing endian functionality. 2018-09-08 20:06:00 +09:00
tbeu
d72765870a Move overflow check up 2018-09-06 15:09:52 +02:00
tbeu
c056026dad Fix memory leaks 2018-09-04 22:24:40 +02:00
jwang
60930f4b12 adding unit tests and fixing same overflow issue in hpp files 2018-09-03 22:23:53 +02:00
Nathan Froyd
b6d4bb5cb0 update boost predef and preprocessor from 1.61.0 to 1.68.0
...via `git submodule foreach git pull origin boost-1.68.0` and
initializing cmake.

Fixes #728.
2018-08-31 14:57:19 -04:00
Takatoshi Kondo
f57bfd998b Updated the version to 3.1.1. 2018-08-28 00:17:42 +09:00
Takatoshi Kondo
53d2ea9ad3 Fixed #724.
Fixed type mismatch in msgpack_timestamp.
Added 64bit singed postfix.
2018-08-27 22:40:04 +09:00
Takatoshi Kondo
a350e0714e
Merge pull request #716 from redboltz/update_310
Updated the version to 3.1.0
2018-08-21 06:43:27 +09:00
Takatoshi Kondo
72757feae4 Updated the version to 3.1.0 2018-08-20 21:58:54 +09:00
Takatoshi Kondo
87863c1696 Removed warnings. 2018-08-12 20:59:00 +09:00