envoyproxy / envoyproxy/envoy

grpc async client should catch proto cast exception

Offen
#5,409 2 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @hello-jianghongke Auf GitHub ansehen
enhancement help wanted
Vorherrschende Sprache
C++
Sterne
28.9k
Forks
5.6k
Ø Merge
1 T. 22 Std.
Gemergte PRs (30 T.)
430

Beschreibung

*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;
}
}
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.