From 5aafae7616157289f21ca8d2ac3f264f0f1ae0fe Mon Sep 17 00:00:00 2001 From: Zak Henry Date: Thu, 22 Aug 2024 13:47:06 +1200 Subject: [PATCH] fix(web): fix empty trailer parsing causing infinite parser loop --- .idea/.gitignore | 8 ++++ .idea/inspectionProfiles/Project_Default.xml | 17 ++++++++ .idea/misc.xml | 4 ++ .idea/modules.xml | 8 ++++ .idea/tonic.iml | 43 ++++++++++++++++++++ .idea/vcs.xml | 6 +++ tonic-web/src/call.rs | 5 ++- 7 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/tonic.iml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 000000000..13566b81b --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 000000000..0bcfe33ff --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 000000000..0a75641dc --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 000000000..66c87c1c2 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/tonic.iml b/.idea/tonic.iml new file mode 100644 index 000000000..a0bc40e99 --- /dev/null +++ b/.idea/tonic.iml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 000000000..35eb1ddfb --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/tonic-web/src/call.rs b/tonic-web/src/call.rs index 2bdcdc60c..6a2fa5472 100644 --- a/tonic-web/src/call.rs +++ b/tonic-web/src/call.rs @@ -305,7 +305,10 @@ where } FindTrailers::IncompleteBuf => continue, FindTrailers::Done(len) => { - Poll::Ready(Some(Ok(Frame::data(buf.split_to(len).freeze())))) + Poll::Ready(match len { + 0 => None, + _ => Some(Ok(Frame::data(buf.split_to(len).freeze()))), + }) } }; }