pw_grpc: Skip HTTP2 frame payload for frames that result in stream reset When receiving invalid frames from a client, some errors result in stream reset (force closure), and some errors result in connection closure. If the error only results in stream reset, the rest of the frames sent in the connection should be readable by the server. This means that the entire frame should be skipped over, with normal connection processing happening after. Previously, the code did not skip past the payload for DATA and HEADERS frames that resulted in a stream-reset error. Thus, when continuing to process the connection, the payload of the frame would be interpreted as the header of the next frame, resulting in a cascade of failures. This commit fixes the issue by ensuring that, for frames with a payload, the payload is skipped when encountering a stream-reset error. For errors that result in a connection error (GOAWAY), there are no changes. Test: Set up a situation where the client sends a DATA frame with a Test: payload on a stream that the server has already closed. Test: Observe that the server recognizes this is data for a closed Test: stream, and that subsequent frames are received and interpreted Test: correctly. Change-Id: Id1e11b74d9fccdeb7285e2455f2675328ac7da91 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/230951 Reviewed-by: Erik Gilling <konkers@google.com> Commit-Queue: Eli Lipsitz <elipsitz@google.com> Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com> Reviewed-by: Austin Foxley <afoxley@google.com> Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.
For more information please see our website: https://pigweed.dev/.