[Libwebsockets] Settings Frame size above max / Flow control exceeded max

Andy Green andy at warmcat.com
Mon Jul 8 09:48:18 CEST 2019



On 7/8/19 8:19 AM, Andreas Lobbes wrote:

> 2019-07-08 09:06:46 INF http2 settings 4 <- 0x10000

...

 > 2019-07-08 09:06:46 INF lws_wsi_server_new: 0x555dc7a20a20 new ch 
0x555dc7a39640, sid 1, usersp=(nil), tx cr 65536, peer_credit 65535 
(nwsi tx_cr 65536)

...

 > 2019-07-08 09:06:46 INF WINDOW_UPDATE: sid 0 2147418112 (0x7fff0000)

... the peer sure looks unreasonable.  It told us to use 0x10000 as the 
initial tx credit which we did, and then it added 0x7fff0000 to it 
before we sent any payload... it overflows the 32-bit signed space 
allowed for it.

What happens if you add a hack to force that to be corrected to not 
overflow?

diff --git a/lib/roles/h2/http2.c b/lib/roles/h2/http2.c
index d819a0f5c..229c5bb70 100644
--- a/lib/roles/h2/http2.c
+++ b/lib/roles/h2/http2.c
@@ -1584,6 +1584,10 @@ lws_h2_parse_end_of_frame(struct lws *wsi)
                         break; /* ignore */
                 }

+               if ((uint64_t)eff_wsi->h2.tx_cr + 
(uint64_t)h2n->hpack_e_dep >
+                   (uint64_t)0x7fffffff)
+                       h2n->hpack_e_dep = 0x7fffffff - eff_wsi->h2.tx_cr;
+
                 if ((uint64_t)eff_wsi->h2.tx_cr + 
(uint64_t)h2n->hpack_e_dep >
                     (uint64_t)0x7fffffff) {
                         if (h2n->sid)


-Andy


More information about the Libwebsockets mailing list