aboutsummaryrefslogtreecommitdiff
path: root/ruby/ext/google
diff options
context:
space:
mode:
Diffstat (limited to 'ruby/ext/google')
-rw-r--r--ruby/ext/google/protobuf_c/encode_decode.c7
-rw-r--r--ruby/ext/google/protobuf_c/wrap_memcpy.c2
2 files changed, 8 insertions, 1 deletions
diff --git a/ruby/ext/google/protobuf_c/encode_decode.c b/ruby/ext/google/protobuf_c/encode_decode.c
index c2c40ddd..0c5a74ab 100644
--- a/ruby/ext/google/protobuf_c/encode_decode.c
+++ b/ruby/ext/google/protobuf_c/encode_decode.c
@@ -1143,6 +1143,13 @@ static void putmsg(VALUE msg_rb, const Descriptor* desc,
TypedData_Get_Struct(msg_rb, MessageHeader, &Message_type, msg);
+ if (desc != msg->descriptor) {
+ rb_raise(rb_eArgError,
+ "The type of given msg is '%s', expect '%s'.",
+ upb_msgdef_fullname(msg->descriptor->msgdef),
+ upb_msgdef_fullname(desc->msgdef));
+ }
+
for (upb_msg_field_begin(&i, desc->msgdef);
!upb_msg_field_done(&i);
upb_msg_field_next(&i)) {
diff --git a/ruby/ext/google/protobuf_c/wrap_memcpy.c b/ruby/ext/google/protobuf_c/wrap_memcpy.c
index 394a52f9..18c03678 100644
--- a/ruby/ext/google/protobuf_c/wrap_memcpy.c
+++ b/ruby/ext/google/protobuf_c/wrap_memcpy.c
@@ -33,7 +33,7 @@
// On x86-64 Linux with glibc, we link against the 2.2.5 version of memcpy so
// that we avoid depending on the 2.14 version of the symbol. This way,
// distributions that are using pre-2.14 versions of glibc can successfully use
-// the gem we distribute (https://github.com/google/protobuf/issues/2783).
+// the gem we distribute (https://github.com/protocolbuffers/protobuf/issues/2783).
//
// This wrapper is enabled by passing the linker flags -Wl,-wrap,memcpy in
// extconf.rb.