envoyproxy / envoyproxy/envoy

grpc async client should catch proto cast exception

Open
#5,409 2 comments 0 reactions 1 assignee Claimed by @hello-jianghongke View on GitHub
enhancement help wanted
Dominant language
C++
Stars
28.9k
Forks
5.6k
Avg merge
1d 22h
Merged PRs (30d)
430

Description

*Title*: *grpc async client should catch proto cast exception*

*Description*:
> grpc async client proto cast catches no exception as follows:
`include\envoy\grpc\async_client.h`
```
void onReceiveMessageUntyped(ProtobufTypes::MessagePtr&& message) override {
onReceiveMessage(std::unique_ptr(dynamic_cast(message.release())));
}
```
which may crashs the process when the received message is not standard, like `00 00 00 00 00`.

And should be modified as follows:
```
void onReceiveMessageUntyped(ProtobufTypes::MessagePtr&& message) override {
try {
onReceiveMessage(std::unique_ptr(dynamic_cast(message.release())));
} catch(const std::exception& e) {
std::cout << "wrong message received, error: " << e.what() << std::endl;
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.