]> git.kaiwu.me - nginx.git/commitdiff
Upstream: reject zero WINDOW_UPDATE increments
authorfelix h <felix314159@users.noreply.github.com>
Wed, 5 Aug 2026 17:07:20 +0000 (19:07 +0200)
committerVinay Kumar Tokala <vinaykumar1591@gmail.com>
Mon, 10 Aug 2026 10:24:23 +0000 (15:54 +0530)
The HTTP/2 proxy and gRPC upstream clients accepted WINDOW_UPDATE
frames with a zero flow-control window increment.  RFC 9113 requires
such frames to be handled as PROTOCOL_ERROR at stream or connection
scope.

Reject these frames as invalid upstream responses.

src/http/modules/ngx_http_grpc_module.c
src/http/modules/ngx_http_proxy_v2_module.c

index 6f1752e5476144f90eaab21dd7ce331438a13d0c..1aecc5aeb202ed2f336ca73acf1d8a62a9633508 100644 (file)
@@ -3865,6 +3865,12 @@ ngx_http_grpc_parse_window_update(ngx_http_request_t *r,
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                    "grpc window update: %ui", ctx->window_update);
 
+    if (ctx->window_update == 0) {
+        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+                      "upstream sent zero window update");
+        return NGX_ERROR;
+    }
+
     if (ctx->stream_id) {
 
         if (ctx->window_update > (size_t) NGX_HTTP_V2_MAX_WINDOW
index cc3f090ca2b10832e5ed53fe916c8f71a7100f72..337561f2dbd2614b641548d0d2a855a9bee03728 100644 (file)
@@ -3690,6 +3690,12 @@ ngx_http_proxy_v2_parse_window_update(ngx_http_request_t *r,
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                    "http proxy window update: %ui", ctx->window_update);
 
+    if (ctx->window_update == 0) {
+        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+                      "upstream sent zero window update");
+        return NGX_ERROR;
+    }
+
     if (ctx->stream_id) {
 
         if (ctx->window_update > (size_t) NGX_HTTP_V2_MAX_WINDOW