24 Commits

Author SHA1 Message Date
Robert Edmonds
e72e7e7e81 add code coverage option to the build system
configure now has a "--enable-code-coverage" option, and if the
lcov/gcov tools are available a code coverage report can be built with
"make check-code-coverage".

this is mostly based on the AX_CODE_COVERAGE / GNOME_CODE_COVERAGE
macro:

    http://savannah.gnu.org/patch/?8451

but i also looked at knot-dns's code coverage implementation:

    https://github.com/CZNIC-Labs/knot/blob/master/m4/code-coverage.m4

and kevin lyda's pull request:

    https://github.com/protobuf-c/protobuf-c/pull/131/files
2014-06-02 17:56:41 -04:00
Robert Edmonds
9eb868d33d TODO: remove 'dispatch-within-dispatch'
it's related to the RPC code, and that's been split out into
protobuf-c-rpc now.
2014-04-04 19:20:51 -04:00
Robert Edmonds
d9a2f8470d protobuf_c_message_unpack(): revert hash-based required field detection
Originally, someone complained about protobuf_c_message_unpack() using
alloca() for the allocation of the temporary bitmap used to detect that
all required fields were present in the unpacked message (Issue #60).
Commit 248eae1d eliminated the use of alloca(), replacing the
variable-length alloca()'d bitmap with a 16 byte stack-allocated bitmap,
treating field numbers mod 128.

Andrei Nigmatulin noted in PR #137 problems with this approach:

    Apparently 248eae1d has introduced a serious problem to protobuf-c
    decoder.

    Originally the function of required_fields_bitmap was to prevent
    decoder from returning incomplete messages. That means, each
    required field in the message either must have a default_value or be
    present in the protobuf stream. The purpose of this behaviour was to
    provide user with 100% complete ProtobufCMessage struct on return
    from protobuf_c_message_unpack(), which does not need to be checked
    for completeness just after. This is exactly how original protobuf
    C++ decoder behaves. The patch 248eae1d broke this functionality by
    hashing bits of required fields instead of storing them separately.

    Consider a protobuf message with 129 fields where the first and the
    last fields set as 'required'. In this case it is possible to trick
    decoder to return incomplete ProtobufCMessage struct with missing
    required fields by providing only one of the two fields in the
    source byte stream. This can be considered as a security issue as
    well because user's code do not expect incomplete messages with
    missing required fields out from protobuf_c_message_unpack(). Such a
    change could introduce undefined behaviour to user programs.

This patch is based on Andrei's fix and restores the exact detection of
missing required fields, but avoids doing a separate allocation for the
required fields bitmap except for messages whose descriptors define a
large number of fields. In the "typical" case where the message
descriptor has <= 128 fields we can just use a 16 byte array allocated
on the stack. (Note that the hash-based approach also used a 16 byte
stack allocated array.)
2014-03-31 16:55:52 -04:00
Robert Edmonds
e3c49dfff2 TODO: remove protobuf-c-rpc 2014-01-10 13:25:11 -05:00
lahiker42@gmail.com
d6857c2e9c ensure enums are the size of ints
git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@329 00440858-1255-0410-a3e6-75ea37f81c3a
2011-11-12 02:32:22 +00:00
lahiker42@gmail.com
16b1297cf3 ..
git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@287 00440858-1255-0410-a3e6-75ea37f81c3a
2011-03-20 02:37:08 +00:00
lahiker42
56f2af6435 .
git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@247 00440858-1255-0410-a3e6-75ea37f81c3a
2010-09-01 04:30:30 +00:00
lahiker42
5beac76ca7 Support for packed-repeated fields.
git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@223 00440858-1255-0410-a3e6-75ea37f81c3a
2010-05-05 12:52:38 +00:00
lahiker42
d59521b812 note change
git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@174 00440858-1255-0410-a3e6-75ea37f81c3a
2009-03-05 03:57:17 +00:00
lahiker42
70b8bf87e8 done item
git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@162 00440858-1255-0410-a3e6-75ea37f81c3a
2009-02-09 03:28:45 +00:00
lahiker42
1cbc75c122 note on extensions
git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@90 00440858-1255-0410-a3e6-75ea37f81c3a
2008-11-30 16:50:59 +00:00
lahiker42
4d47e97990 notes...
git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@89 00440858-1255-0410-a3e6-75ea37f81c3a
2008-11-30 15:57:52 +00:00
lahiker42
a499b3ae4e git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@81 00440858-1255-0410-a3e6-75ea37f81c3a 2008-11-28 05:03:52 +00:00
lahiker42
d98ac01c95 ...
git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@80 00440858-1255-0410-a3e6-75ea37f81c3a
2008-11-28 05:01:49 +00:00
lahiker42
eefc67e5fe cleanups
git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@79 00440858-1255-0410-a3e6-75ea37f81c3a
2008-11-28 04:59:52 +00:00
lahiker42
f3ed0fa1c9 updates to work with latest protobuf
git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@63 00440858-1255-0410-a3e6-75ea37f81c3a
2008-09-09 18:18:28 +00:00
lahiker42
9e2a16a72a spruce up todo file
git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@54 00440858-1255-0410-a3e6-75ea37f81c3a
2008-08-27 03:51:24 +00:00
lahiker42
7b7b5e25f4 optimize and implement enum/message/service descriptor
lookups by name and value.


git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@51 00440858-1255-0410-a3e6-75ea37f81c3a
2008-08-27 02:14:42 +00:00
lahiker42
c4442d125c Work on simplerpc. revisit service api.. may need to rerevisit
git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@46 00440858-1255-0410-a3e6-75ea37f81c3a
2008-08-25 17:50:52 +00:00
lahiker42
f87e0849ea use uint8_t and size_t where appropriate.
implement and test unknown fields


git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@44 00440858-1255-0410-a3e6-75ea37f81c3a
2008-08-24 18:37:43 +00:00
lahiker42
1265baa325 many bug fixes, and lots of test code
git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@36 00440858-1255-0410-a3e6-75ea37f81c3a
2008-08-24 03:00:21 +00:00
lahiker42
6ffe171d9f random todo items
git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@35 00440858-1255-0410-a3e6-75ea37f81c3a
2008-08-23 20:44:49 +00:00
lahiker42
ee774e97ad add static init
add test code (beginnings of very thorough test)


git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@33 00440858-1255-0410-a3e6-75ea37f81c3a
2008-08-23 19:59:17 +00:00
lahiker42
a9c16cc839 git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@21 00440858-1255-0410-a3e6-75ea37f81c3a 2008-08-22 22:15:42 +00:00