src/http/modules/ngx_http_range_filter_module.c:326: error: Integer Overflow L2
  ([0, `ranges`] - 1):unsigned64.

src/http/modules/ngx_http_range_filter_module.c:240:1: <LHS trace>
238. 
239. 
240. static ngx_int_t
     ^
241. ngx_http_range_parse(ngx_http_request_t *r, ngx_http_range_filter_ctx_t *ctx,
242.     ngx_uint_t ranges)

src/http/modules/ngx_http_range_filter_module.c:240:1: Parameter `ranges`
238. 
239. 
240. static ngx_int_t
     ^
241. ngx_http_range_parse(ngx_http_request_t *r, ngx_http_range_filter_ctx_t *ctx,
242.     ngx_uint_t ranges)

src/http/modules/ngx_http_range_filter_module.c:326:17: Binary operation: ([0, ranges] - 1):unsigned64
324.             size += end - start;
325. 
326.             if (ranges-- == 0) {
                     ^
327.                 return NGX_DECLINED;
328.             }

static ngx_int_t
ngx_http_range_parse(ngx_http_request_t *r, ngx_http_range_filter_ctx_t *ctx,
    ngx_uint_t ranges)
{
    u_char            *p;
    off_t              start, end, size, content_length;
    ngx_uint_t         suffix;
    ngx_http_range_t  *range;
    p = r->headers_in.range->value.data + 6;
    size = 0;
    content_length = r->headers_out.content_length_n;
    for ( ;; ) {
        start = 0;
        end = 0;
        suffix = 0;
        while (*p == ' ') { p++; }
        if (*p != '-') {
            if (*p < '0' || *p > '9') {
                return NGX_HTTP_RANGE_NOT_SATISFIABLE;
            }
            while (*p >= '0' && *p <= '9') {
                start = start * 10 + *p++ - '0';
            }
            while (*p == ' ') { p++; }
            if (*p++ != '-') {
                return NGX_HTTP_RANGE_NOT_SATISFIABLE;
            }
            while (*p == ' ') { p++; }
            if (*p == ',' || *p == '\0') {
                end = content_length;
                goto found;
            }
        } else {
            suffix = 1;
            p++;
        }
        if (*p < '0' || *p > '9') {
            return NGX_HTTP_RANGE_NOT_SATISFIABLE;
        }
        while (*p >= '0' && *p <= '9') {
            end = end * 10 + *p++ - '0';
        }
        while (*p == ' ') { p++; }
        if (*p != ',' && *p != '\0') {
            return NGX_HTTP_RANGE_NOT_SATISFIABLE;
        }
        if (suffix) {
            start = content_length - end;
            end = content_length - 1;
        }
        if (end >= content_length) {
            end = content_length;
        } else {
            end++;
        }
    found:
        if (start < end) {
            range = ngx_array_push(&ctx->ranges);
            if (range == NULL) {
                return NGX_ERROR;
            }
            range->start = start;
            range->end = end;
            size += end - start;
            if (ranges-- == 0) {
                return NGX_DECLINED;
            }
        }
        if (*p++ != ',') {
            break;
        }
    }
    if (ctx->ranges.nelts == 0) {
        return NGX_HTTP_RANGE_NOT_SATISFIABLE;
    }
    if (size > content_length) {
        return NGX_DECLINED;
    }
    return NGX_OK;
}
["static ngx_int_t\nngx_http_range_parse(ngx_http_request_t *r, ngx_http_range_filter_ctx_t *ctx,\n    ngx_uint_t ranges)\n{\n    u_char            *p;\n    off_t              start, end, size, content_length;\n    ngx_uint_t         suffix;\n    ngx_http_range_t  *range;\n    p = r->headers_in.range->value.data + 6;\n    size = 0;\n    content_length = r->headers_out.content_length_n;\n    for ( ;; ) {\n        start = 0;\n        end = 0;\n        suffix = 0;\n        while (*p == ' ') { p++; }\n        if (*p != '-') {\n            if (*p < '0' || *p > '9') {\n                return NGX_HTTP_RANGE_NOT_SATISFIABLE;\n            }\n            while (*p >= '0' && *p <= '9') {\n                start = start * 10 + *p++ - '0';\n            }\n            while (*p == ' ') { p++; }\n            if (*p++ != '-') {\n                return NGX_HTTP_RANGE_NOT_SATISFIABLE;\n            }\n            while (*p == ' ') { p++; }\n            if (*p == ',' || *p == '\\0') {\n                end = content_length;\n                goto found;\n            }\n        } else {\n            suffix = 1;\n            p++;\n        }\n        if (*p < '0' || *p > '9') {\n            return NGX_HTTP_RANGE_NOT_SATISFIABLE;\n        }\n        while (*p >= '0' && *p <= '9') {\n            end = end * 10 + *p++ - '0';\n        }\n        while (*p == ' ') { p++; }\n        if (*p != ',' && *p != '\\0') {\n            return NGX_HTTP_RANGE_NOT_SATISFIABLE;\n        }\n        if (suffix) {\n            start = content_length - end;\n            end = content_length - 1;\n        }\n        if (end >= content_length) {\n            end = content_length;\n        } else {\n            end++;\n        }\n    found:\n        if (start < end) {\n            range = ngx_array_push(&ctx->ranges);\n            if (range == NULL) {\n                return NGX_ERROR;\n            }\n            range->start = start;\n            range->end = end;\n            size += end - start;\n            if (ranges-- == 0) {\n                return NGX_DECLINED;\n            }\n        }\n        if (*p++ != ',') {\n            break;\n        }\n    }\n    if (ctx->ranges.nelts == 0) {\n        return NGX_HTTP_RANGE_NOT_SATISFIABLE;\n    }\n    if (size > content_length) {\n        return NGX_DECLINED;\n    }\n    return NGX_OK;\n}"]