# HG changeset patch # User Valentin Bartenev # Date 1445365718 -10800 # Node ID ee16fb0db905cfb858a929374cf623cdf1a0f9d3 # Parent adaac65899c81506089a20646c291408385b58ee 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. diff -r adaac65899c8 -r ee16fb0db905 src/http/v2/ngx_http_v2.c --- a/src/http/v2/ngx_http_v2.c Tue Oct 20 21:26:38 2015 +0300 +++ b/src/http/v2/ngx_http_v2.c Tue Oct 20 21:28:38 2015 +0300 @@ -2417,14 +2417,14 @@ } } + 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; }