Fixed grpc health check bug#13870
Conversation
Signed-off-by: Zach <zasweq@google.com>
Signed-off-by: Zach <zasweq@google.com>
|
/assign @asraa @adisuissa @htuch @mattklein123 |
adisuissa
left a comment
There was a problem hiding this comment.
Thanks for fixing this, I'll close my PR for now.
What happens if the gRPC decoder clears the output (frames) if the decoding fails?
There was a problem hiding this comment.
Out of curiosity, is it the presence of null bytes in the frame data that makes the grpc decoder fail or is it something in conjunction with that?
(if so, is it easy to simplify the test case?)
It looks like
envoy/source/common/grpc/codec.cc
Line 48 in bd73f3c
|
\cc @fengli79 |
Signed-off-by: Zach <zasweq@google.com>
asraa
left a comment
There was a problem hiding this comment.
Thanks, please check format!
Signed-off-by: Zach <zasweq@google.com>
Signed-off-by: Zach <zasweq@google.com>
asraa
left a comment
There was a problem hiding this comment.
Thanks, LGTM!
@envoyproxy/senior-maintainers could you please take a very quick look to approve this bug fix handling a faulty response?
Signed-off-by: Zach <zasweq@google.com>
|
LGTM can you merge main? /wait |
Signed-off-by: Zach Reyes zasweq@google.com
Commit Message: Fixed gRPC health check bug
Additional Description: Fixes issue https://oss-fuzz.com/testcase-detail/6242204122873856. My health check fuzzer ran into this bug. What happened with this bug was that the decoder for gRPC frames sometimes encoded frames into a frame vector even though decode() returns false in the case of valid frames and then invalid frames in the buffer. Thus, this section of decodeData() called decoder_->decode() which returned false, which led to onRpcComplete being called: https://github.com/envoyproxy/envoy/blob/master/source/common/upstream/health_checker_impl.cc#L623. Thus, I added a return (which used to be implicit) after this, as frames() may still put frames in the grpc frame vector, thus calling onRpcComplete() again in the same decodeData() and causing a null dereference. I also added unit tests to show that the decoder can still put frames in the output vector even though it fails eventually and returns false.
Same as #13855, but different fix.
Risk Level: Low
Testing: Added regression test.