diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index 02bc98a1cc3d..3effb88b606e 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -229,6 +229,9 @@ jobs: # pkg-config formula is removed from GitHub Actions runner. brew uninstall pkg-config || : brew uninstall pkg-config@0.29.2 || : + # Workaround for https://github.com/grpc/grpc/issues/41755 + # Remove once the runner ships a newer Homebrew. + brew update brew bundle --file=cpp/Brewfile - name: Install MinIO run: | diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index b200b37d1fe0..aa333606529b 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -199,8 +199,10 @@ jobs: # pkg-config formula is removed from GitHub Actions runner. brew uninstall pkg-config || : brew uninstall pkg-config@0.29.2 || : + # Workaround for https://github.com/grpc/grpc/issues/41755 + # Remove once the runner ships a newer Homebrew. + brew update brew bundle --file=cpp/Brewfile - python -m pip install \ -r python/requirements-build.txt \ -r python/requirements-test.txt diff --git a/cpp/src/arrow/engine/substrait/expression_internal.cc b/cpp/src/arrow/engine/substrait/expression_internal.cc index d91edbfce6d2..09b295632b82 100644 --- a/cpp/src/arrow/engine/substrait/expression_internal.cc +++ b/cpp/src/arrow/engine/substrait/expression_internal.cc @@ -804,7 +804,13 @@ struct ScalarToProtoImpl { auto user_defined = std::make_unique(); user_defined->set_type_reference(anchor); auto value_any = std::make_unique(); +#if PROTOBUF_VERSION >= 3015000 + if (!value_any->PackFrom(value)) { + return Status::IOError("Failed to pack user-defined type value"); + } +#else value_any->PackFrom(value); +#endif user_defined->set_allocated_value(value_any.release()); lit_->set_allocated_user_defined(user_defined.release()); return Status::OK(); diff --git a/cpp/src/arrow/engine/substrait/options.cc b/cpp/src/arrow/engine/substrait/options.cc index f8e717338658..0c647df54fda 100644 --- a/cpp/src/arrow/engine/substrait/options.cc +++ b/cpp/src/arrow/engine/substrait/options.cc @@ -68,17 +68,23 @@ class DefaultExtensionProvider : public BaseExtensionProvider { const ExtensionSet& ext_set) override { if (rel.Is()) { substrait_ext::AsOfJoinRel as_of_join_rel; - rel.UnpackTo(&as_of_join_rel); + if (!rel.UnpackTo(&as_of_join_rel)) { + return Status::IOError("Failed to unpack AsOfJoinRel"); + } return MakeAsOfJoinRel(inputs, as_of_join_rel, ext_set); } if (rel.Is()) { substrait_ext::NamedTapRel named_tap_rel; - rel.UnpackTo(&named_tap_rel); + if (!rel.UnpackTo(&named_tap_rel)) { + return Status::IOError("Failed to unpack NamedTapRel"); + } return MakeNamedTapRel(conv_opts, inputs, named_tap_rel, ext_set); } if (rel.Is()) { substrait_ext::SegmentedAggregateRel seg_agg_rel; - rel.UnpackTo(&seg_agg_rel); + if (!rel.UnpackTo(&seg_agg_rel)) { + return Status::IOError("Failed to unpack SegmentedAggregateRel"); + } return MakeSegmentedAggregateRel(conv_opts, inputs, seg_agg_rel, ext_set); } return Status::NotImplemented("Unrecognized extension in Substrait plan: ", diff --git a/cpp/src/arrow/flight/sql/server.cc b/cpp/src/arrow/flight/sql/server.cc index 8471fa8a2b1e..10dd073b6227 100644 --- a/cpp/src/arrow/flight/sql/server.cc +++ b/cpp/src/arrow/flight/sql/server.cc @@ -537,7 +537,13 @@ arrow::Result CreateStatementQueryTicket( ticket_statement_query.set_statement_handle(statement_handle); google::protobuf::Any ticket; +#if PROTOBUF_VERSION >= 3015000 + if (!ticket.PackFrom(ticket_statement_query)) { + return Status::IOError("Failed to pack ticket"); + } +#else ticket.PackFrom(ticket_statement_query); +#endif std::string ticket_string; diff --git a/cpp/src/arrow/flight/transport/grpc/serialization_internal.cc b/cpp/src/arrow/flight/transport/grpc/serialization_internal.cc index 0b8c90a08eb8..d4848c5077d1 100644 --- a/cpp/src/arrow/flight/transport/grpc/serialization_internal.cc +++ b/cpp/src/arrow/flight/transport/grpc/serialization_internal.cc @@ -353,7 +353,10 @@ ::grpc::Status FlightDataDeserialize(ByteBuffer* buffer, // Can't use ParseFromCodedStream as this reads the entire // rest of the stream into the descriptor command field. std::string buffer; - pb_stream.ReadString(&buffer, length); + if (!pb_stream.ReadString(&buffer, length)) { + return {::grpc::StatusCode::INTERNAL, + "Unable to read FlightDescriptor from protobuf"}; + } if (!pb_descriptor.ParseFromString(buffer)) { return {::grpc::StatusCode::INTERNAL, "Unable to parse FlightDescriptor"}; }