src/http/modules/ngx_http_log_module.c:1282: error: Integer Overflow L2
  ([0, +oo] - 1):unsigned64 by call to `ngx_parse_size`.

src/http/modules/ngx_http_log_module.c:1197:9: Call
1195.     }
1196. 
1197.     n = ngx_http_script_variables_count(&value[1]);
              ^
1198. 
1199.     if (n == 0) {

src/http/ngx_http_script.c:317:1: Parameter `value->len`
  315. 
  316. 
  317. ngx_uint_t
       ^
  318. ngx_http_script_variables_count(ngx_str_t *value)
  319. {

src/http/modules/ngx_http_log_module.c:1200:21: Call
1198. 
1199.     if (n == 0) {
1200.         log->file = ngx_conf_open_file(cf->cycle, &value[1]);
                          ^
1201.         if (log->file == NULL) {
1202.             return NGX_CONF_ERROR;

src/core/ngx_conf_file.c:811:1: Parameter `name->len`
  809. 
  810. 
  811. ngx_open_file_t *
       ^
  812. ngx_conf_open_file(ngx_cycle_t *cycle, ngx_str_t *name)
  813. {

src/http/modules/ngx_http_log_module.c:1279:13: Assignment
1277. 
1278.         if (ngx_strncmp(value[i].data, "buffer=", 7) == 0) {
1279.             s.len = value[i].len - 7;
                  ^
1280.             s.data = value[i].data + 7;
1281. 

src/http/modules/ngx_http_log_module.c:1282:20: Call
1280.             s.data = value[i].data + 7;
1281. 
1282.             size = ngx_parse_size(&s);
                         ^
1283. 
1284.             if (size == NGX_ERROR || size == 0) {

src/core/ngx_parse.c:12:1: <LHS trace>
10. 
11. 
12. ssize_t
    ^
13. ngx_parse_size(ngx_str_t *line)
14. {

src/core/ngx_parse.c:12:1: Parameter `line->len`
  10. 
  11. 
  12. ssize_t
      ^
  13. ngx_parse_size(ngx_str_t *line)
  14. {

src/core/ngx_parse.c:20:5: Assignment
  18.     ngx_int_t  scale;
  19. 
  20.     len = line->len;
          ^
  21.     unit = line->data[len - 1];
  22. 

src/core/ngx_parse.c:21:12: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ngx_parse_size` 
  19. 
  20.     len = line->len;
  21.     unit = line->data[len - 1];
                 ^
  22. 
  23.     switch (unit) {

ssize_t
ngx_parse_size(ngx_str_t *line)
{
    u_char     unit;
    size_t     len;
    ssize_t    size;
    ngx_int_t  scale;
    len = line->len;
    unit = line->data[len - 1];
    switch (unit) {
    case 'K':
    case 'k':
        len--;
        scale = 1024;
        break;
    case 'M':
    case 'm':
        len--;
        scale = 1024 * 1024;
        break;
    default:
        scale = 1;
    }
    size = ngx_atosz(line->data, len);
    if (size == NGX_ERROR) {
        return NGX_ERROR;
    }
    size *= scale;
    return size;
}
['static char *\nngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)\n{\n    ngx_http_log_loc_conf_t *llcf = conf;\n    ssize_t                            size;\n    ngx_int_t                          gzip;\n    ngx_uint_t                         i, n;\n    ngx_msec_t                         flush;\n    ngx_str_t                         *value, name, s, filter;\n    ngx_http_log_t                    *log;\n    ngx_syslog_peer_t                 *peer;\n    ngx_http_log_buf_t                *buffer;\n    ngx_http_log_fmt_t                *fmt;\n    ngx_http_log_main_conf_t          *lmcf;\n    ngx_http_script_compile_t          sc;\n    ngx_http_compile_complex_value_t   ccv;\n    value = cf->args->elts;\n    if (ngx_strcmp(value[1].data, "off") == 0) {\n        llcf->off = 1;\n        if (cf->args->nelts == 2) {\n            return NGX_CONF_OK;\n        }\n        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,\n                           "invalid parameter \\"%V\\"", &value[2]);\n        return NGX_CONF_ERROR;\n    }\n    if (llcf->logs == NULL) {\n        llcf->logs = ngx_array_create(cf->pool, 2, sizeof(ngx_http_log_t));\n        if (llcf->logs == NULL) {\n            return NGX_CONF_ERROR;\n        }\n    }\n    lmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_log_module);\n    log = ngx_array_push(llcf->logs);\n    if (log == NULL) {\n        return NGX_CONF_ERROR;\n    }\n    ngx_memzero(log, sizeof(ngx_http_log_t));\n    if (ngx_strncmp(value[1].data, "syslog:", 7) == 0) {\n        peer = ngx_pcalloc(cf->pool, sizeof(ngx_syslog_peer_t));\n        if (peer == NULL) {\n            return NGX_CONF_ERROR;\n        }\n        if (ngx_syslog_process_conf(cf, peer) != NGX_CONF_OK) {\n            return NGX_CONF_ERROR;\n        }\n        log->syslog_peer = peer;\n        goto process_formats;\n    }\n    n = ngx_http_script_variables_count(&value[1]);\n    if (n == 0) {\n        log->file = ngx_conf_open_file(cf->cycle, &value[1]);\n        if (log->file == NULL) {\n            return NGX_CONF_ERROR;\n        }\n    } else {\n        if (ngx_conf_full_name(cf->cycle, &value[1], 0) != NGX_OK) {\n            return NGX_CONF_ERROR;\n        }\n        log->script = ngx_pcalloc(cf->pool, sizeof(ngx_http_log_script_t));\n        if (log->script == NULL) {\n            return NGX_CONF_ERROR;\n        }\n        ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));\n        sc.cf = cf;\n        sc.source = &value[1];\n        sc.lengths = &log->script->lengths;\n        sc.values = &log->script->values;\n        sc.variables = n;\n        sc.complete_lengths = 1;\n        sc.complete_values = 1;\n        if (ngx_http_script_compile(&sc) != NGX_OK) {\n            return NGX_CONF_ERROR;\n        }\n    }\nprocess_formats:\n    if (cf->args->nelts >= 3) {\n        name = value[2];\n        if (ngx_strcmp(name.data, "combined") == 0) {\n            lmcf->combined_used = 1;\n        }\n    } else {\n        ngx_str_set(&name, "combined");\n        lmcf->combined_used = 1;\n    }\n    fmt = lmcf->formats.elts;\n    for (i = 0; i < lmcf->formats.nelts; i++) {\n        if (fmt[i].name.len == name.len\n            && ngx_strcasecmp(fmt[i].name.data, name.data) == 0)\n        {\n            log->format = &fmt[i];\n            break;\n        }\n    }\n    if (log->format == NULL) {\n        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,\n                           "unknown log format \\"%V\\"", &name);\n        return NGX_CONF_ERROR;\n    }\n    if (log->syslog_peer != NULL) {\n        if (cf->args->nelts > 3) {\n            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,\n                               "parameter \\"%V\\" is not supported by syslog",\n                               &value[3]);\n            return NGX_CONF_ERROR;\n        }\n        return NGX_CONF_OK;\n    }\n    size = 0;\n    flush = 0;\n    gzip = 0;\n    filter.len = 0;\n    for (i = 3; i < cf->args->nelts; i++) {\n        if (ngx_strncmp(value[i].data, "buffer=", 7) == 0) {\n            s.len = value[i].len - 7;\n            s.data = value[i].data + 7;\n            size = ngx_parse_size(&s);\n            if (size == NGX_ERROR || size == 0) {\n                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,\n                                   "invalid buffer size \\"%V\\"", &s);\n                return NGX_CONF_ERROR;\n            }\n            continue;\n        }\n        if (ngx_strncmp(value[i].data, "flush=", 6) == 0) {\n            s.len = value[i].len - 6;\n            s.data = value[i].data + 6;\n            flush = ngx_parse_time(&s, 0);\n            if (flush == (ngx_msec_t) NGX_ERROR || flush == 0) {\n                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,\n                                   "invalid flush time \\"%V\\"", &s);\n                return NGX_CONF_ERROR;\n            }\n            continue;\n        }\n        if (ngx_strncmp(value[i].data, "gzip", 4) == 0\n            && (value[i].len == 4 || value[i].data[4] == \'=\'))\n        {\n#if (NGX_ZLIB)\n            if (size == 0) {\n                size = 64 * 1024;\n            }\n            if (value[i].len == 4) {\n                gzip = Z_BEST_SPEED;\n                continue;\n            }\n            s.len = value[i].len - 5;\n            s.data = value[i].data + 5;\n            gzip = ngx_atoi(s.data, s.len);\n            if (gzip < 1 || gzip > 9) {\n                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,\n                                   "invalid compression level \\"%V\\"", &s);\n                return NGX_CONF_ERROR;\n            }\n            continue;\n#else\n            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,\n                               "nginx was built without zlib support");\n            return NGX_CONF_ERROR;\n#endif\n        }\n        if (ngx_strncmp(value[i].data, "if=", 3) == 0) {\n            filter.len = value[i].len - 3;\n            filter.data = value[i].data + 3;\n            continue;\n        }\n        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,\n                           "invalid parameter \\"%V\\"", &value[i]);\n        return NGX_CONF_ERROR;\n    }\n    if (flush && size == 0) {\n        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,\n                           "no buffer is defined for access_log \\"%V\\"",\n                           &value[1]);\n        return NGX_CONF_ERROR;\n    }\n    if (size) {\n        if (log->script) {\n            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,\n                               "buffered logs cannot have variables in name");\n            return NGX_CONF_ERROR;\n        }\n        if (log->file->data) {\n            buffer = log->file->data;\n            if (buffer->last - buffer->start != size\n                || buffer->flush != flush\n                || buffer->gzip != gzip)\n            {\n                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,\n                                   "access_log \\"%V\\" already defined "\n                                   "with conflicting parameters",\n                                   &value[1]);\n                return NGX_CONF_ERROR;\n            }\n            return NGX_CONF_OK;\n        }\n        buffer = ngx_pcalloc(cf->pool, sizeof(ngx_http_log_buf_t));\n        if (buffer == NULL) {\n            return NGX_CONF_ERROR;\n        }\n        buffer->start = ngx_pnalloc(cf->pool, size);\n        if (buffer->start == NULL) {\n            return NGX_CONF_ERROR;\n        }\n        buffer->pos = buffer->start;\n        buffer->last = buffer->start + size;\n        if (flush) {\n            buffer->event = ngx_pcalloc(cf->pool, sizeof(ngx_event_t));\n            if (buffer->event == NULL) {\n                return NGX_CONF_ERROR;\n            }\n            buffer->event->data = log->file;\n            buffer->event->handler = ngx_http_log_flush_handler;\n            buffer->event->log = &cf->cycle->new_log;\n            buffer->flush = flush;\n        }\n        buffer->gzip = gzip;\n        log->file->flush = ngx_http_log_flush;\n        log->file->data = buffer;\n    }\n    if (filter.len) {\n        log->filter = ngx_palloc(cf->pool, sizeof(ngx_http_complex_value_t));\n        if (log->filter == NULL) {\n            return NGX_CONF_ERROR;\n        }\n        ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));\n        ccv.cf = cf;\n        ccv.value = &filter;\n        ccv.complex_value = log->filter;\n        if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {\n            return NGX_CONF_ERROR;\n        }\n    }\n    return NGX_CONF_OK;\n}', "ngx_uint_t\nngx_http_script_variables_count(ngx_str_t *value)\n{\n    ngx_uint_t  i, n;\n    for (n = 0, i = 0; i < value->len; i++) {\n        if (value->data[i] == '$') {\n            n++;\n        }\n    }\n    return n;\n}", 'ngx_open_file_t *\nngx_conf_open_file(ngx_cycle_t *cycle, ngx_str_t *name)\n{\n    ngx_str_t         full;\n    ngx_uint_t        i;\n    ngx_list_part_t  *part;\n    ngx_open_file_t  *file;\n#if (NGX_SUPPRESS_WARN)\n    ngx_str_null(&full);\n#endif\n    if (name->len) {\n        full = *name;\n        if (ngx_conf_full_name(cycle, &full, 0) != NGX_OK) {\n            return NULL;\n        }\n        part = &cycle->open_files.part;\n        file = part->elts;\n        for (i = 0;   ; i++) {\n            if (i >= part->nelts) {\n                if (part->next == NULL) {\n                    break;\n                }\n                part = part->next;\n                file = part->elts;\n                i = 0;\n            }\n            if (full.len != file[i].name.len) {\n                continue;\n            }\n            if (ngx_strcmp(full.data, file[i].name.data) == 0) {\n                return &file[i];\n            }\n        }\n    }\n    file = ngx_list_push(&cycle->open_files);\n    if (file == NULL) {\n        return NULL;\n    }\n    if (name->len) {\n        file->fd = NGX_INVALID_FILE;\n        file->name = full;\n    } else {\n        file->fd = ngx_stderr;\n        file->name = *name;\n    }\n    file->flush = NULL;\n    file->data = NULL;\n    return file;\n}', "ssize_t\nngx_parse_size(ngx_str_t *line)\n{\n    u_char     unit;\n    size_t     len;\n    ssize_t    size;\n    ngx_int_t  scale;\n    len = line->len;\n    unit = line->data[len - 1];\n    switch (unit) {\n    case 'K':\n    case 'k':\n        len--;\n        scale = 1024;\n        break;\n    case 'M':\n    case 'm':\n        len--;\n        scale = 1024 * 1024;\n        break;\n    default:\n        scale = 1;\n    }\n    size = ngx_atosz(line->data, len);\n    if (size == NGX_ERROR) {\n        return NGX_ERROR;\n    }\n    size *= scale;\n    return size;\n}"]