]> git.kaiwu.me - nginx.git/commitdiff
HTTP/2: improved error handling while parsing integers.
authorValentin Bartenev <vbart@nginx.com>
Tue, 20 Oct 2015 18:28:38 +0000 (21:28 +0300)
committerValentin Bartenev <vbart@nginx.com>
Tue, 20 Oct 2015 18:28:38 +0000 (21:28 +0300)
The case when an integer is out of frame bounds should be checked first
as a more accurate error.

src/http/v2/ngx_http_v2.c

index 5852c994362573eeb8fb0a89ffa7aa99ebe85c9b..91f7bc9e162aa5c346d969a9bf500667e900464a 100644 (file)
@@ -2417,14 +2417,14 @@ ngx_http_v2_parse_int(ngx_http_v2_connection_t *h2c, u_char **pos, u_char *end,
         }
     }
 
-    if (end == start + NGX_HTTP_V2_INT_OCTETS) {
-        return NGX_DECLINED;
-    }
-
     if ((size_t) (end - start) >= h2c->state.length) {
         return NGX_ERROR;
     }
 
+    if (end == start + NGX_HTTP_V2_INT_OCTETS) {
+        return NGX_DECLINED;
+    }
+
     return NGX_AGAIN;
 }