changeset 6268:ee16fb0db905

HTTP/2: improved error handling while parsing integers. The case when an integer is out of frame bounds should be checked first as a more accurate error.
author Valentin Bartenev <vbart@nginx.com>
date Tue, 20 Oct 2015 21:28:38 +0300
parents adaac65899c8
children 7ec809b579d7
files src/http/v2/ngx_http_v2.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -2417,14 +2417,14 @@ ngx_http_v2_parse_int(ngx_http_v2_connec
         }
     }
 
+    if ((size_t) (end - start) >= h2c->state.length) {
+        return NGX_ERROR;
+    }
+
     if (end == start + NGX_HTTP_V2_INT_OCTETS) {
         return NGX_DECLINED;
     }
 
-    if ((size_t) (end - start) >= h2c->state.length) {
-        return NGX_ERROR;
-    }
-
     return NGX_AGAIN;
 }