Commit 45ae8134 authored by Matteo Basso's avatar Matteo Basso

Update to protobuf-c 1.3.2 and Protobuf Java Lite 3.11.0

parent 3284c43f
......@@ -15,6 +15,6 @@
<classpathentry kind="lib" path="lib/disl/asm-analysis.jar" sourcepath="lib/devel/asm-analysis-source.jar"/>
<classpathentry kind="lib" path="lib/disl/asm-commons.jar" sourcepath="lib/devel/asm-commons-source.jar"/>
<classpathentry kind="lib" path="lib/disl/asm-util.jar" sourcepath="lib/devel/asm-util-source.jar"/>
<classpathentry kind="lib" path="lib/disl/protobuf-lite.jar"/>
<classpathentry kind="lib" path="lib/disl/protobuf-javalite.jar"/>
<classpathentry kind="output" path="output/build/disl"/>
</classpath>
......@@ -12,6 +12,6 @@ asm.org=org.ow2.asm
log4j.rev=1.2.17
log4j.org=log4j
protobuf.rev=3.0.1
protobuf.rev=3.11.0
protobuf.org=com.google.protobuf
protobuf.lib=protobuf-lite
protobuf.lib=protobuf-javalite
......@@ -6,6 +6,6 @@ lib/disl/asm-tree.jar
lib/disl/asm-util.jar
lib/disl/asm.jar
lib/disl/log4j.jar
lib/disl/protobuf-lite.jar
lib/disl/protobuf-javalite.jar
lib/test/hamcrest-core.jar
lib/test/junit.jar
......@@ -219,10 +219,8 @@ __instrument_class (
// connection again.
//
InstrumentClassRequest request = INSTRUMENT_CLASS_REQUEST__INIT;
request.has_flags = true;
request.flags = request_flags;
request.classname = (char *) class_name;
request.has_classbytes = true;
request.classbytes.len = class_def->class_byte_count;
request.classbytes.data = (uint8_t *) class_def->class_bytes;
......@@ -266,7 +264,6 @@ __instrument_class (
class_def->class_byte_count = response->classbytes.len;
class_def->class_bytes = response->classbytes.data;
response->has_classbytes = false;
response->classbytes.len = 0;
response->classbytes.data = NULL;
......
......@@ -10,7 +10,7 @@
void instrument_class_request__init
(InstrumentClassRequest *message)
{
static InstrumentClassRequest init_value = INSTRUMENT_CLASS_REQUEST__INIT;
static const InstrumentClassRequest init_value = INSTRUMENT_CLASS_REQUEST__INIT;
*message = init_value;
}
size_t instrument_class_request__get_packed_size
......@@ -47,13 +47,15 @@ void instrument_class_request__free_unpacked
(InstrumentClassRequest *message,
ProtobufCAllocator *allocator)
{
if(!message)
return;
assert(message->base.descriptor == &instrument_class_request__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
void instrument_class_response__init
(InstrumentClassResponse *message)
{
static InstrumentClassResponse init_value = INSTRUMENT_CLASS_RESPONSE__INIT;
static const InstrumentClassResponse init_value = INSTRUMENT_CLASS_RESPONSE__INIT;
*message = init_value;
}
size_t instrument_class_response__get_packed_size
......@@ -90,6 +92,8 @@ void instrument_class_response__free_unpacked
(InstrumentClassResponse *message,
ProtobufCAllocator *allocator)
{
if(!message)
return;
assert(message->base.descriptor == &instrument_class_response__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
......@@ -98,9 +102,9 @@ static const ProtobufCFieldDescriptor instrument_class_request__field_descriptor
{
"flags",
1,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_LABEL_NONE,
PROTOBUF_C_TYPE_INT32,
offsetof(InstrumentClassRequest, has_flags),
0, /* quantifier_offset */
offsetof(InstrumentClassRequest, flags),
NULL,
NULL,
......@@ -110,21 +114,21 @@ static const ProtobufCFieldDescriptor instrument_class_request__field_descriptor
{
"className",
2,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_LABEL_NONE,
PROTOBUF_C_TYPE_STRING,
0, /* quantifier_offset */
offsetof(InstrumentClassRequest, classname),
NULL,
NULL,
&protobuf_c_empty_string,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"classBytes",
3,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_LABEL_NONE,
PROTOBUF_C_TYPE_BYTES,
offsetof(InstrumentClassRequest, has_classbytes),
0, /* quantifier_offset */
offsetof(InstrumentClassRequest, classbytes),
NULL,
NULL,
......@@ -162,9 +166,9 @@ static const ProtobufCFieldDescriptor instrument_class_response__field_descripto
{
"result",
1,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_LABEL_NONE,
PROTOBUF_C_TYPE_ENUM,
offsetof(InstrumentClassResponse, has_result),
0, /* quantifier_offset */
offsetof(InstrumentClassResponse, result),
&instrument_class_result__descriptor,
NULL,
......@@ -174,21 +178,21 @@ static const ProtobufCFieldDescriptor instrument_class_response__field_descripto
{
"errorMessage",
2,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_LABEL_NONE,
PROTOBUF_C_TYPE_STRING,
0, /* quantifier_offset */
offsetof(InstrumentClassResponse, errormessage),
NULL,
NULL,
&protobuf_c_empty_string,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"classBytes",
3,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_LABEL_NONE,
PROTOBUF_C_TYPE_BYTES,
offsetof(InstrumentClassResponse, has_classbytes),
0, /* quantifier_offset */
offsetof(InstrumentClassResponse, classbytes),
NULL,
NULL,
......
......@@ -8,9 +8,9 @@
PROTOBUF_C__BEGIN_DECLS
#if PROTOBUF_C_VERSION_NUMBER < 1000000
#if PROTOBUF_C_VERSION_NUMBER < 1003000
# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
#elif 1002001 < PROTOBUF_C_MIN_COMPILER_VERSION
#elif 1003002 < PROTOBUF_C_MIN_COMPILER_VERSION
# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c.
#endif
......@@ -33,29 +33,25 @@ typedef enum _InstrumentClassResult {
struct _InstrumentClassRequest
{
ProtobufCMessage base;
protobuf_c_boolean has_flags;
int32_t flags;
char *classname;
protobuf_c_boolean has_classbytes;
ProtobufCBinaryData classbytes;
};
#define INSTRUMENT_CLASS_REQUEST__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&instrument_class_request__descriptor) \
, 0,0, NULL, 0,{0,NULL} }
, 0, (char *)protobuf_c_empty_string, {0,NULL} }
struct _InstrumentClassResponse
{
ProtobufCMessage base;
protobuf_c_boolean has_result;
InstrumentClassResult result;
char *errormessage;
protobuf_c_boolean has_classbytes;
ProtobufCBinaryData classbytes;
};
#define INSTRUMENT_CLASS_RESPONSE__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&instrument_class_response__descriptor) \
, 0,0, NULL, 0,{0,NULL} }
, INSTRUMENT_CLASS_RESULT__CLASS_UNMODIFIED, (char *)protobuf_c_empty_string, {0,NULL} }
/* InstrumentClassRequest methods */
......
......@@ -2072,6 +2072,11 @@ parse_tag_and_wiretype(size_t len,
unsigned shift = 4;
unsigned rv;
/* 0 is not a valid tag value */
if ((data[0] & 0xf8) == 0) {
return 0;
}
*wiretype_out = data[0] & 7;
if ((data[0] & 0x80) == 0) {
*tag_out = tag;
......@@ -2103,18 +2108,18 @@ struct _ScannedMember {
const uint8_t *data; /**< Pointer to field data. */
};
static inline uint32_t
static inline size_t
scan_length_prefixed_data(size_t len, const uint8_t *data,
size_t *prefix_len_out)
{
unsigned hdr_max = len < 5 ? len : 5;
unsigned hdr_len;
uint32_t val = 0;
size_t val = 0;
unsigned i;
unsigned shift = 0;
for (i = 0; i < hdr_max; i++) {
val |= (data[i] & 0x7f) << shift;
val |= ((size_t)data[i] & 0x7f) << shift;
shift += 7;
if ((data[i] & 0x80) == 0)
break;
......@@ -2125,8 +2130,15 @@ scan_length_prefixed_data(size_t len, const uint8_t *data,
}
hdr_len = i + 1;
*prefix_len_out = hdr_len;
if (val > INT_MAX) {
// Protobuf messages should always be less than 2 GiB in size.
// We also want to return early here so that hdr_len + val does
// not overflow on 32-bit systems.
PROTOBUF_C_UNPACK_ERROR("length prefix of %lu is too large", val);
return 0;
}
if (hdr_len + val > len) {
PROTOBUF_C_UNPACK_ERROR("data too short after length-prefix of %u", val);
PROTOBUF_C_UNPACK_ERROR("data too short after length-prefix of %lu", val);
return 0;
}
return hdr_len + val;
......@@ -2239,6 +2251,8 @@ merge_messages(ProtobufCMessage *earlier_msg,
latter_msg->descriptor
->field_ranges,
*earlier_case_p);
if (field_index < 0)
return FALSE;
field = latter_msg->descriptor->fields +
field_index;
} else {
......@@ -2627,14 +2641,17 @@ parse_oneof_member (ScannedMember *scanned_member,
/* If we have already parsed a member of this oneof, free it. */
if (*oneof_case != 0) {
const ProtobufCFieldDescriptor *old_field;
size_t el_size;
/* lookup field */
int field_index =
int_range_lookup(message->descriptor->n_field_ranges,
message->descriptor->field_ranges,
*oneof_case);
const ProtobufCFieldDescriptor *old_field =
message->descriptor->fields + field_index;
size_t el_size = sizeof_elt_in_repeated_array(old_field->type);
if (field_index < 0)
return FALSE;
old_field = message->descriptor->fields + field_index;
el_size = sizeof_elt_in_repeated_array(old_field->type);
switch (old_field->type) {
case PROTOBUF_C_TYPE_STRING: {
......@@ -3411,6 +3428,13 @@ protobuf_c_message_check(const ProtobufCMessage *message)
ProtobufCLabel label = f->label;
void *field = STRUCT_MEMBER_P (message, f->offset);
if (f->flags & PROTOBUF_C_FIELD_FLAG_ONEOF) {
const uint32_t *oneof_case = STRUCT_MEMBER_P (message, f->quantifier_offset);
if (f->id != *oneof_case) {
continue; //Do not check if it is an unpopulated oneof member.
}
}
if (label == PROTOBUF_C_LABEL_REPEATED) {
size_t *quantity = STRUCT_MEMBER_P (message, f->quantifier_offset);
......@@ -3639,4 +3663,4 @@ protobuf_c_service_descriptor_get_method_by_name(const ProtobufCServiceDescripto
if (strcmp(desc->methods[desc->method_indices_by_name[start]].name, name) == 0)
return desc->methods + desc->method_indices_by_name[start];
return NULL;
}
}
\ No newline at end of file
/*
* Copyright (c) 2008-2017, Dave Benson and the protobuf-c authors.
* Copyright (c) 2008-2018, Dave Benson and the protobuf-c authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
......@@ -790,13 +790,13 @@ protobuf_c_version_number(void);
* The version of the protobuf-c headers, represented as a string using the same
* format as protobuf_c_version().
*/
#define PROTOBUF_C_VERSION "1.3.0"
#define PROTOBUF_C_VERSION "1.3.2"
/**
* The version of the protobuf-c headers, represented as an integer using the
* same format as protobuf_c_version_number().
*/
#define PROTOBUF_C_VERSION_NUMBER 1003000
#define PROTOBUF_C_VERSION_NUMBER 1003002
/**
* The minimum protoc-c version which works with the current version of the
......@@ -1103,4 +1103,4 @@ protobuf_c_service_invoke_internal(
PROTOBUF_C__END_DECLS
#endif /* PROTOBUF_C_H */
#endif /* PROTOBUF_C_H */
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment