]> git.kaiwu.me - nginx.git/commitdiff
HTTP/3: require that field section base index is not negative.
authorRoman Arutyunyan <arut@nginx.com>
Thu, 26 May 2022 12:17:56 +0000 (16:17 +0400)
committerRoman Arutyunyan <arut@nginx.com>
Thu, 26 May 2022 12:17:56 +0000 (16:17 +0400)
RFC 9204 explicitly requires that.

src/http/v3/ngx_http_v3_parse.c

index cd70bd3bf604640f2694a5cdee00ff091933f1bb..7dc53493cb0ee22c111d3ebcf86e11b7d0d8292c 100644 (file)
@@ -474,7 +474,13 @@ done:
     }
 
     if (st->sign) {
+        if (st->insert_count <= st->delta_base) {
+            ngx_log_error(NGX_LOG_INFO, c->log, 0, "client sent negative base");
+            return NGX_HTTP_V3_ERR_DECOMPRESSION_FAILED;
+        }
+
         st->base = st->insert_count - st->delta_base - 1;
+
     } else {
         st->base = st->insert_count + st->delta_base;
     }