From f321d6a4de0e32068d31c1605c5a93efe6568b0b Mon Sep 17 00:00:00 2001 From: Zak Henry Date: Fri, 23 Aug 2024 18:37:18 +1200 Subject: [PATCH] fix(web): fix empty trailer parsing causing infinite parser loop (#1883) --- tonic-web/src/call.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tonic-web/src/call.rs b/tonic-web/src/call.rs index 2bdcdc60c..4b66e44f0 100644 --- a/tonic-web/src/call.rs +++ b/tonic-web/src/call.rs @@ -304,9 +304,10 @@ where } } FindTrailers::IncompleteBuf => continue, - FindTrailers::Done(len) => { - Poll::Ready(Some(Ok(Frame::data(buf.split_to(len).freeze())))) - } + FindTrailers::Done(len) => Poll::Ready(match len { + 0 => None, + _ => Some(Ok(Frame::data(buf.split_to(len).freeze()))), + }), }; } }