[nginx] gRPC: improved window updates checking.
Maxim Dounin
mdounin at mdounin.ru
Tue Nov 24 15:44:35 UTC 2026
details: http://freenginx.org/hg/nginx/rev/0a8d0b2aae20
branches: stable-1.30
changeset: 9624:0a8d0b2aae20
user: Maxim Dounin <mdounin at mdounin.ru>
date: Tue Nov 24 06:19:20 2026 +0300
description:
gRPC: improved window updates checking.
Following changes in HTTP/2, window updates are now rejected as long as
the current send window is larger than NGX_HTTP_V2_MAX_WINDOW minus the
window update sent by the client, so no overflows or underflows are
possible. Additionally, the check on the window update itself ensures
it is no larger than the maximum (which is not possible per protocol, so
the check is provided for clarity).
This ensures that window updates are properly rejected even if the
current send window happens to be larger than NGX_HTTP_V2_MAX_WINDOW for
some reason.
diffstat:
src/http/modules/ngx_http_grpc_module.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (25 lines):
diff --git a/src/http/modules/ngx_http_grpc_module.c b/src/http/modules/ngx_http_grpc_module.c
--- a/src/http/modules/ngx_http_grpc_module.c
+++ b/src/http/modules/ngx_http_grpc_module.c
@@ -3729,8 +3729,9 @@ ngx_http_grpc_parse_window_update(ngx_ht
if (ctx->stream_id) {
- if (ctx->window_update > (size_t) NGX_HTTP_V2_MAX_WINDOW
- - ctx->send_window)
+ if (ctx->window_update > NGX_HTTP_V2_MAX_WINDOW
+ || ctx->send_window > (ssize_t) (NGX_HTTP_V2_MAX_WINDOW
+ - ctx->window_update))
{
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"upstream sent too large window update");
@@ -3742,7 +3743,8 @@ ngx_http_grpc_parse_window_update(ngx_ht
} else {
if (ctx->window_update > NGX_HTTP_V2_MAX_WINDOW
- - ctx->connection->send_window)
+ || ctx->connection->send_window > NGX_HTTP_V2_MAX_WINDOW
+ - ctx->window_update)
{
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"upstream sent too large window update");
More information about the nginx-devel
mailing list