From 20724211247b27e903bd25cdbe4ee4aab81445a8 Mon Sep 17 00:00:00 2001 From: "xiaofeng@google.com" Date: Wed, 16 May 2012 05:41:31 +0000 Subject: [PATCH] Fix issue 378 --- src/google/protobuf/compiler/cpp/cpp_string_field.cc | 3 ++- src/google/protobuf/compiler/plugin.pb.cc | 3 ++- src/google/protobuf/descriptor.pb.cc | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.cc b/src/google/protobuf/compiler/cpp/cpp_string_field.cc index 8d611b690..3cec2b6ba 100644 --- a/src/google/protobuf/compiler/cpp/cpp_string_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_string_field.cc @@ -398,7 +398,8 @@ GenerateMergeFromCodedStream(io::Printer* printer) const { descriptor_->type() == FieldDescriptor::TYPE_STRING) { printer->Print(variables_, "::google::protobuf::internal::WireFormat::VerifyUTF8String(\n" - " this->$name$(0).data(), this->$name$(0).length(),\n" + " this->$name$(this->$name$_size() - 1).data(),\n" + " this->$name$(this->$name$_size() - 1).length(),\n" " ::google::protobuf::internal::WireFormat::PARSE);\n"); } } diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index dc188c961..05ff2f048 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -243,7 +243,8 @@ bool CodeGeneratorRequest::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->add_file_to_generate())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( - this->file_to_generate(0).data(), this->file_to_generate(0).length(), + this->file_to_generate(this->file_to_generate_size() - 1).data(), + this->file_to_generate(this->file_to_generate_size() - 1).length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 5697b38ad..b0f0e90e5 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -1065,7 +1065,8 @@ bool FileDescriptorProto::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->add_dependency())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( - this->dependency(0).data(), this->dependency(0).length(), + this->dependency(this->dependency_size() - 1).data(), + this->dependency(this->dependency_size() - 1).length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted;