src/http/modules/ngx_http_userid_filter_module.c:475: error: Null Dereference
  pointer `vv` last assigned on line 473 could be null and is dereferenced at line 475, column 13.

src/http/modules/ngx_http_userid_filter_module.c:455:1: start of procedure ngx_http_userid_create_uid()
453. 
454. 
455. static ngx_int_t
     ^
456. ngx_http_userid_create_uid(ngx_http_request_t *r, ngx_http_userid_ctx_t *ctx,
457.     ngx_http_userid_conf_t *conf)

src/http/modules/ngx_http_userid_filter_module.c:467:9: Taking false branch
465. #endif
466. 
467.     if (ctx->uid_set[3] != 0) {
             ^
468.         return NGX_OK;
469.     }

src/http/modules/ngx_http_userid_filter_module.c:471:9: Taking true branch
469.     }
470. 
471.     if (ctx->uid_got[3] != 0) {
             ^
472. 
473.         vv = ngx_http_get_indexed_variable(r, ngx_http_userid_reset_index);

src/http/modules/ngx_http_userid_filter_module.c:473:9: 
471.     if (ctx->uid_got[3] != 0) {
472. 
473.         vv = ngx_http_get_indexed_variable(r, ngx_http_userid_reset_index);
             ^
474. 
475.         if (vv->len == 0 || (vv->len == 1 && vv->data[0] == '0')) {

src/http/ngx_http_variables.c:577:1: start of procedure ngx_http_get_indexed_variable()
  575. 
  576. 
  577. ngx_http_variable_value_t *
       ^
  578. ngx_http_get_indexed_variable(ngx_http_request_t *r, ngx_uint_t index)
  579. {

src/http/ngx_http_variables.c:583:5: 
  581.     ngx_http_core_main_conf_t  *cmcf;
  582. 
  583.     cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
           ^
  584. 
  585.     if (cmcf->variables.nelts <= index) {

src/http/ngx_http_variables.c:585:9: Taking false branch
  583.     cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
  584. 
  585.     if (cmcf->variables.nelts <= index) {
               ^
  586.         ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
  587.                       "unknown variable index: %ui", index);

src/http/ngx_http_variables.c:591:9: Taking false branch
  589.     }
  590. 
  591.     if (r->variables[index].not_found || r->variables[index].valid) {
               ^
  592.         return &r->variables[index];
  593.     }

src/http/ngx_http_variables.c:591:42: Taking false branch
  589.     }
  590. 
  591.     if (r->variables[index].not_found || r->variables[index].valid) {
                                                ^
  592.         return &r->variables[index];
  593.     }

src/http/ngx_http_variables.c:595:5: 
  593.     }
  594. 
  595.     v = cmcf->variables.elts;
           ^
  596. 
  597.     if (ngx_http_variable_depth == 0) {

src/http/ngx_http_variables.c:597:9: Taking false branch
  595.     v = cmcf->variables.elts;
  596. 
  597.     if (ngx_http_variable_depth == 0) {
               ^
  598.         ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
  599.                       "cycle while evaluating variable \"%V\"",

src/http/ngx_http_variables.c:604:5: 
  602.     }
  603. 
  604.     ngx_http_variable_depth--;
           ^
  605. 
  606.     if (v[index].get_handler(r, &r->variables[index], v[index].data)

src/http/ngx_http_variables.c:606:9: Taking false branch
  604.     ngx_http_variable_depth--;
  605. 
  606.     if (v[index].get_handler(r, &r->variables[index], v[index].data)
               ^
  607.         == NGX_OK)
  608.     {

src/http/ngx_http_variables.c:618:5: 
  616.     }
  617. 
  618.     ngx_http_variable_depth++;
           ^
  619. 
  620.     r->variables[index].valid = 0;

src/http/ngx_http_variables.c:620:5: 
  618.     ngx_http_variable_depth++;
  619. 
  620.     r->variables[index].valid = 0;
           ^
  621.     r->variables[index].not_found = 1;
  622. 

src/http/ngx_http_variables.c:621:5: 
  619. 
  620.     r->variables[index].valid = 0;
  621.     r->variables[index].not_found = 1;
           ^
  622. 
  623.     return NULL;

src/http/ngx_http_variables.c:623:5: 
  621.     r->variables[index].not_found = 1;
  622. 
  623.     return NULL;
           ^
  624. }
  625. 

src/http/ngx_http_variables.c:624:1: return from a call to ngx_http_get_indexed_variable
  622. 
  623.     return NULL;
  624. }
       ^
  625. 
  626. 

src/http/modules/ngx_http_userid_filter_module.c:475:13: 
473.         vv = ngx_http_get_indexed_variable(r, ngx_http_userid_reset_index);
474. 
475.         if (vv->len == 0 || (vv->len == 1 && vv->data[0] == '0')) {
                 ^
476. 
477.             if (conf->mark == '\0'

static ngx_int_t
ngx_http_userid_create_uid(ngx_http_request_t *r, ngx_http_userid_ctx_t *ctx,
    ngx_http_userid_conf_t *conf)
{
    ngx_connection_t           *c;
    struct sockaddr_in         *sin;
    ngx_http_variable_value_t  *vv;
#if (NGX_HAVE_INET6)
    u_char                     *p;
    struct sockaddr_in6        *sin6;
#endif
    if (ctx->uid_set[3] != 0) {
        return NGX_OK;
    }
    if (ctx->uid_got[3] != 0) {
        vv = ngx_http_get_indexed_variable(r, ngx_http_userid_reset_index);
        if (vv->len == 0 || (vv->len == 1 && vv->data[0] == '0')) {
            if (conf->mark == '\0'
                || (ctx->cookie.len > 23
                    && ctx->cookie.data[22] == conf->mark
                    && ctx->cookie.data[23] == '='))
            {
                return NGX_OK;
            }
            ctx->uid_set[0] = ctx->uid_got[0];
            ctx->uid_set[1] = ctx->uid_got[1];
            ctx->uid_set[2] = ctx->uid_got[2];
            ctx->uid_set[3] = ctx->uid_got[3];
            return NGX_OK;
        } else {
            ctx->reset = 1;
            if (vv->len == 3 && ngx_strncmp(vv->data, "log", 3) == 0) {
                ngx_log_error(NGX_LOG_NOTICE, r->connection->log, 0,
                        "userid cookie \"%V=%08XD%08XD%08XD%08XD\" was reset",
                        &conf->name, ctx->uid_got[0], ctx->uid_got[1],
                        ctx->uid_got[2], ctx->uid_got[3]);
            }
        }
    }
    if (conf->enable == NGX_HTTP_USERID_V1) {
        if (conf->service == NGX_CONF_UNSET) {
            ctx->uid_set[0] = 0;
        } else {
            ctx->uid_set[0] = conf->service;
        }
        ctx->uid_set[1] = (uint32_t) ngx_time();
        ctx->uid_set[2] = start_value;
        ctx->uid_set[3] = sequencer_v1;
        sequencer_v1 += 0x100;
    } else {
        if (conf->service == NGX_CONF_UNSET) {
            c = r->connection;
            if (ngx_connection_local_sockaddr(c, NULL, 0) != NGX_OK) {
                return NGX_ERROR;
            }
            switch (c->local_sockaddr->sa_family) {
#if (NGX_HAVE_INET6)
            case AF_INET6:
                sin6 = (struct sockaddr_in6 *) c->local_sockaddr;
                p = (u_char *) &ctx->uid_set[0];
                *p++ = sin6->sin6_addr.s6_addr[12];
                *p++ = sin6->sin6_addr.s6_addr[13];
                *p++ = sin6->sin6_addr.s6_addr[14];
                *p = sin6->sin6_addr.s6_addr[15];
                break;
#endif
            default:
                sin = (struct sockaddr_in *) c->local_sockaddr;
                ctx->uid_set[0] = sin->sin_addr.s_addr;
                break;
            }
        } else {
            ctx->uid_set[0] = htonl(conf->service);
        }
        ctx->uid_set[1] = htonl((uint32_t) ngx_time());
        ctx->uid_set[2] = htonl(start_value);
        ctx->uid_set[3] = htonl(sequencer_v2);
        sequencer_v2 += 0x100;
        if (sequencer_v2 < 0x03030302) {
            sequencer_v2 = 0x03030302;
        }
    }
    return NGX_OK;
}
['static ngx_int_t\nngx_http_userid_create_uid(ngx_http_request_t *r, ngx_http_userid_ctx_t *ctx,\n    ngx_http_userid_conf_t *conf)\n{\n    ngx_connection_t           *c;\n    struct sockaddr_in         *sin;\n    ngx_http_variable_value_t  *vv;\n#if (NGX_HAVE_INET6)\n    u_char                     *p;\n    struct sockaddr_in6        *sin6;\n#endif\n    if (ctx->uid_set[3] != 0) {\n        return NGX_OK;\n    }\n    if (ctx->uid_got[3] != 0) {\n        vv = ngx_http_get_indexed_variable(r, ngx_http_userid_reset_index);\n        if (vv->len == 0 || (vv->len == 1 && vv->data[0] == \'0\')) {\n            if (conf->mark == \'\\0\'\n                || (ctx->cookie.len > 23\n                    && ctx->cookie.data[22] == conf->mark\n                    && ctx->cookie.data[23] == \'=\'))\n            {\n                return NGX_OK;\n            }\n            ctx->uid_set[0] = ctx->uid_got[0];\n            ctx->uid_set[1] = ctx->uid_got[1];\n            ctx->uid_set[2] = ctx->uid_got[2];\n            ctx->uid_set[3] = ctx->uid_got[3];\n            return NGX_OK;\n        } else {\n            ctx->reset = 1;\n            if (vv->len == 3 && ngx_strncmp(vv->data, "log", 3) == 0) {\n                ngx_log_error(NGX_LOG_NOTICE, r->connection->log, 0,\n                        "userid cookie \\"%V=%08XD%08XD%08XD%08XD\\" was reset",\n                        &conf->name, ctx->uid_got[0], ctx->uid_got[1],\n                        ctx->uid_got[2], ctx->uid_got[3]);\n            }\n        }\n    }\n    if (conf->enable == NGX_HTTP_USERID_V1) {\n        if (conf->service == NGX_CONF_UNSET) {\n            ctx->uid_set[0] = 0;\n        } else {\n            ctx->uid_set[0] = conf->service;\n        }\n        ctx->uid_set[1] = (uint32_t) ngx_time();\n        ctx->uid_set[2] = start_value;\n        ctx->uid_set[3] = sequencer_v1;\n        sequencer_v1 += 0x100;\n    } else {\n        if (conf->service == NGX_CONF_UNSET) {\n            c = r->connection;\n            if (ngx_connection_local_sockaddr(c, NULL, 0) != NGX_OK) {\n                return NGX_ERROR;\n            }\n            switch (c->local_sockaddr->sa_family) {\n#if (NGX_HAVE_INET6)\n            case AF_INET6:\n                sin6 = (struct sockaddr_in6 *) c->local_sockaddr;\n                p = (u_char *) &ctx->uid_set[0];\n                *p++ = sin6->sin6_addr.s6_addr[12];\n                *p++ = sin6->sin6_addr.s6_addr[13];\n                *p++ = sin6->sin6_addr.s6_addr[14];\n                *p = sin6->sin6_addr.s6_addr[15];\n                break;\n#endif\n            default:\n                sin = (struct sockaddr_in *) c->local_sockaddr;\n                ctx->uid_set[0] = sin->sin_addr.s_addr;\n                break;\n            }\n        } else {\n            ctx->uid_set[0] = htonl(conf->service);\n        }\n        ctx->uid_set[1] = htonl((uint32_t) ngx_time());\n        ctx->uid_set[2] = htonl(start_value);\n        ctx->uid_set[3] = htonl(sequencer_v2);\n        sequencer_v2 += 0x100;\n        if (sequencer_v2 < 0x03030302) {\n            sequencer_v2 = 0x03030302;\n        }\n    }\n    return NGX_OK;\n}', 'ngx_http_variable_value_t *\nngx_http_get_indexed_variable(ngx_http_request_t *r, ngx_uint_t index)\n{\n    ngx_http_variable_t        *v;\n    ngx_http_core_main_conf_t  *cmcf;\n    cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);\n    if (cmcf->variables.nelts <= index) {\n        ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,\n                      "unknown variable index: %ui", index);\n        return NULL;\n    }\n    if (r->variables[index].not_found || r->variables[index].valid) {\n        return &r->variables[index];\n    }\n    v = cmcf->variables.elts;\n    if (ngx_http_variable_depth == 0) {\n        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,\n                      "cycle while evaluating variable \\"%V\\"",\n                      &v[index].name);\n        return NULL;\n    }\n    ngx_http_variable_depth--;\n    if (v[index].get_handler(r, &r->variables[index], v[index].data)\n        == NGX_OK)\n    {\n        ngx_http_variable_depth++;\n        if (v[index].flags & NGX_HTTP_VAR_NOCACHEABLE) {\n            r->variables[index].no_cacheable = 1;\n        }\n        return &r->variables[index];\n    }\n    ngx_http_variable_depth++;\n    r->variables[index].valid = 0;\n    r->variables[index].not_found = 1;\n    return NULL;\n}']