702 Commits

Author SHA1 Message Date
Ilya Lipnitskiy
2102d3a2c5 CMakeLists.txt: Don't include Dart if no tests
Also use BUILD_TESTS instead of CMAKE_BUILD_TYPE in other places in the
file.
2020-05-13 13:38:34 -07:00
Ilya Lipnitskiy
4c86c6b333 Add test for #389 2020-05-13 13:20:48 -07:00
Ilya Lipnitskiy
e43ed4f01d protobuf-c.c: Cast %lu args to unsigned long int
Resolves an ambiguity that %zu was meant to address, since %zu is not
present on all platforms.

Fixes #357.
2020-05-13 10:52:15 -07:00
Ilya Lipnitskiy
4c8043d026 protobuf-c.h: Fix Windows DLL export (Fixes #331)
protobuf_c_empty_string is used in generated .pb-c.{c,h} files so it
should be exported properly.
2020-05-12 17:54:15 -07:00
Ilya Lipnitskiy
93afe2d52d c_message.cc: Resolve name conflict (Fixes #389) 2020-05-12 12:21:48 -07:00
James Benton
e01b30d4fe Add BUILD_TESTS option to CMake build. 2020-05-12 10:21:30 -07:00
Ilya Lipnitskiy
56b8d915be Move Doxygen back to GitHub domain
lib.protobuf-c.io is no longer reachable.
2020-05-09 15:23:27 -07:00
Ilya Lipnitskiy
12973e7f3f CMakeLists.txt: Add option to disable protoc-gen-c 2020-05-09 15:08:28 -07:00
Ilya Lipnitskiy
3d3b5fe220 CMakeLists.txt: Enforce C++11 for old compilers 2020-05-09 14:29:06 -07:00
Ilya Lipnitskiy
ce75229b6a CMakeLists.txt: Fix protoc-c crashes on Linux
-lpthread was missing from the linker command line. See
https://github.com/protocolbuffers/protobuf/issues/5107 for more
details.

.travis.yml: Run CMake debug build for verification
2020-05-09 13:27:33 -07:00
Ilya Lipnitskiy
db6c49cc43 CMakeLists.txt: Add pkg-config logic (Fixes #339) 2020-05-09 13:27:23 -07:00
Ilya Lipnitskiy
d6eaa410b6 libprotobuf-c.pc.in: Add URL, use standard macros
PACKAGE_DESCRIPTION is defined in configure.ac. PACKAGE_NAME,
PACKAGE_VERSION, and PACKAGE_URL come from AC_INIT.

This change will ensure that libprotobuf-c.pc.in could also be used by
CMake.
2020-05-08 18:52:42 -07:00
Robert Edmonds
39cd58f5ff
Merge pull request #399 from protobuf-c/edmonds/version/1.3.3
Bump version to 1.3.3
2020-02-13 18:43:35 -05:00
Robert Edmonds
f20a3fa131 ChangeLog: 1.3.3 v1.3.3 2020-02-13 18:42:42 -05:00
Robert Edmonds
d0531beaad Bump version to 1.3.3 2019-12-04 16:08:05 -05:00
Robert Edmonds
e7c18ecda7
Merge pull request #350 from msshapira/patch-2
fix suport for MSVC static build
2019-12-04 13:35:36 -05:00
Markus Engel
687f27726c Fixed endianness check for cmake
Signed-off-by: Markus Engel <engel@sero-systems.de>
2019-10-18 21:23:55 -04:00
Robert Edmonds
ef868b712f
Merge pull request #400 from protobuf-c/ilya-zigzag
protobuf-c.c: Make zigzag encoding more compact
2019-10-18 21:21:27 -04:00
Robert Edmonds
ff04761e39
Merge pull request #392 from acozzette/fix-test-asserts
Fixed some test assertions in test-generated-code2.c
2019-10-18 21:15:21 -04:00
Robert Edmonds
1f3d4e2e94
Merge pull request #378 from protobuf-c/ilya/coverage
.travis.yml: Reenable code coverage
2019-10-18 21:14:22 -04:00
Ilya Lipnitskiy
66e8aa5ed3 protobuf-c.c: Make zigzag encoding more compact
Also match upstream code in src/google/protobuf/wire_format_lite.h
2019-10-18 10:40:24 -07:00
Robert Edmonds
9f89e64083
Merge pull request #398 from protobuf-c/edmonds/issue330-requires-proto3
Makefile.am: Only enable the Issue #330 test case when building against protobuf 3.x
2019-10-17 20:19:43 -04:00
Robert Edmonds
dc3057c840 Makefile.am: Only enable the Issue #330 test case when building against protobuf 3.x
Issue #330 is a bug in proto3 behavior and the test case handling it
needs a 'syntax = "proto3";' line in its .proto file, which is not
supported by the protobuf 2 implementation.

Since we still support building against protobuf 2, this commit
conditionalizes the Issue #330 test case so that it is only built when
protobuf-c is being built against protobuf 3.
2019-10-17 19:01:35 -04:00
Adam Cozzette
5ee9afdc15 Fixed some test assertions in test-generated-code2.c
I fixed a couple test assertions here that seemed to be accidentally
using assignment (=) instead of equality (==).
2019-08-27 11:07:26 -07:00
Robert Edmonds
1390409f4e
Merge pull request #384 from protobuf-c/edmonds/version/1.3.2
Bump version to 1.3.2
v1.3.2
2019-06-24 01:07:52 -04:00
Robert Edmonds
1f68c67e15 ChangeLog: 1.3.2 2019-06-24 00:52:57 -04:00
Robert Edmonds
62ecf2b467 Bump version to 1.3.2 2019-06-24 00:37:47 -04:00
Ilya Lipnitskiy
8f92882d4b .travis.yml: Reenable code coverage
Code coverage option was removed in the xenial update change (fe36c1677)
2019-05-20 10:49:27 -07:00
Robert Edmonds
d712e0c52d
Merge pull request #299 from guerital/tag-zero-fix
Check if tag is equal to 0
2019-05-18 18:06:19 -04:00
Robert Edmonds
4a7fde66fc Fix whitespace error in previous commit 2019-05-18 17:52:58 -04:00
Robert Edmonds
a6556fb372
Merge pull request #358 from ugurkoltuk-adyen/ugurkoltuk-adyen/message_check_fix
Fix a SEGV on on protobuf_c_message_check on messages with 'oneof's inside
2019-05-18 17:52:13 -04:00
Jurriaan Bremer
b8cd15a84f protobuf-c: Fix -Wdeclaration-after-statement warning in parse_oneof_member()
* allow compilation with -pedantic (thanks @Bun)

Can be reproduced with the following command:

$ make CFLAGS=-pedantic protobuf-c/protobuf-c.o

* put el-size on a separate line
2019-05-18 17:47:23 -04:00
Robert Edmonds
c404ce3eb0
Merge pull request #377 from protobuf-c/ilya/issue330
Fix proto3 repeated scalar field default packing behavior (#330)
2019-05-18 17:16:37 -04:00
Robert Edmonds
ffe38d4df5
Merge branch 'next' into ilya/issue330 2019-05-18 17:02:29 -04:00
Robert Edmonds
2f98c76676
Merge pull request #376 from acozzette/fix-375
Fixed out-of-bounds read (#375)
2019-05-18 16:43:15 -04:00
Ilya Lipnitskiy
69c39824cf protoc-c/c_field.cc: Fix proto3 field packing #330
Fixes #330 and makes scalar repeated fields packed by default in proto3.

https://developers.google.com/protocol-buffers/docs/encoding#packed:
In proto3, repeated fields of scalar numeric types are packed by
default.
2019-05-17 13:29:06 -07:00
Ilya Lipnitskiy
6aa7dc7a10 Add test case for #330 2019-05-17 13:29:06 -07:00
Adam Cozzette
d58d7ca271 Fixed out-of-bounds read
The scan_length_prefixed_data() function returns the number of bytes
taken up by a varint length delimiter, plus the actual value of that
delimiter. Since it returns a uint32_t, a delimiter of 2^32 - 1 (or
close to that) could cause the return value to overflow and result in an
incorrect value.

At first I tried to fix it by making scan_length_prefixed_data() use a
size_t for its result, but I realized this would have no effect on
32-bit systems. To fix the problem for 32-bit, I changed the function to
return early if the length is 2 GiB or more (protobuf messages are not
allowed to be that large). I kept the size_t change anyway, since the
result will ultimately be stored in a size_t (ScannedMember.len) and we
might as well stay consistent with that.

Signed-off-by: Adam Cozzette <acozzette@google.com>
2019-05-16 12:30:08 -07:00
Hayri Ugur Koltuk
ad6952d9f2 Add test case for protobuf_c_check SEGV on unpopulated oneof member
Signed-off-by: Hayri Ugur Koltuk <ugur.koltuk@adyen.com>
2019-04-16 09:30:08 +02:00
Robert Edmonds
9412830d06
Merge pull request #369 from protobuf-c/edmonds/protobuf-reflection-typedef-test-fix
t/generated-code2/cxx-generate-packed-data.cc: Fix build failure on newer protobuf
2019-04-10 21:43:03 -04:00
Robert Edmonds
7456d16212 t/generated-code2/cxx-generate-packed-data.cc: Fix build failure on newer protobuf
google::protobuf::Message::Reflection has been removed in newer versions
of protobuf. The replacement is google::protobuf::Reflection.

protobuf in commit 779f61c6a3ce02a119e28e802f229e61b69b9046 ("Integrate
recent changes from google3.", from August 2008) changed the following
in message.h:

    @@ -336,7 +337,8 @@ class LIBPROTOBUF_EXPORT Message {

       // Introspection ---------------------------------------------------

    -  class Reflection;  // Defined below.
    +  // Typedef for backwards-compatibility.
    +  typedef google::protobuf::Reflection Reflection;

The "typedef for backwards-compatibility" apparently lasted ten years
until protobuf commit 6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3
("Down-integrate from google3.", from August 2018) which finally removed
the typedef:

    @@ -327,8 +344,6 @@ class LIBPROTOBUF_EXPORT Message : public MessageLite {

       // Introspection ---------------------------------------------------

    -  // Typedef for backwards-compatibility.
    -  typedef google::protobuf::Reflection Reflection;

This commit updates the only use of this typedef (in the test suite) to
directly refer to the replacement, google::protobuf::Reflection. This
fixes the build failure in the test suite.
2019-04-10 20:47:48 -04:00
Robert Edmonds
8a362db917
Merge pull request #368 from protobuf-c/edmonds/travis/protobuf-3.7.1
.travis.yml: Bump protobuf version to 3.7.1, use new URL
2019-04-10 20:46:27 -04:00
Robert Edmonds
8067d454b7 .travis.yml: Bump protobuf version to 3.7.1, use new URL 2019-04-10 20:28:52 -04:00
Hayri Ugur Koltuk
5d043e544f Fix a SEGV on on protobuf_c_check on messages with oneofs inside
Signed-off-by: Hayri Ugur Koltuk <ugur.koltuk@adyen.com>
2019-02-05 13:57:07 +01:00
msshapira
4d9d0614d4
fix suport for MSVC static build 2018-11-12 17:43:59 +02:00
Robert Edmonds
269771b4b4
Merge pull request #335 from protobuf-c/edmonds/version/1.3.1
Bump version to 1.3.1
v1.3.1
2018-08-14 00:00:07 -04:00
Robert Edmonds
91486fdd11 ChangeLog: 1.3.1 2018-08-13 23:42:41 -04:00
Robert Edmonds
53bf6c0b7c Bump version to 1.3.1 2018-08-13 23:18:25 -04:00
Robert Edmonds
4176920e6b
Merge pull request #334 from protobuf-c/edmonds/ax_cxx_compile_stdcxx
Use AX_CXX_COMPILE_STDCXX macro to enable C++11 support in old compilers
2018-08-13 23:11:57 -04:00
Robert Edmonds
defc6f044b Revert ".travis.yml: Force C++ standard language version"
This reverts commit 0585e053a8723fbdea4deefe17b6a6512274cde5.

Now that we autodetect any needed flags to enable C++11 support with the
AX_CXX_COMPILE_STDCXX macro, we no longer need to force this in
.travis.yml.
2018-08-13 22:39:31 -04:00