crypto/x509/x509_vfy.c:382: error: NULL_DEREFERENCE
  pointer `x` last assigned on line 380 could be null and is dereferenced at line 382, column 17.
Showing all 23 steps of the trace


crypto/x509/x509_vfy.c:340:1: start of procedure check_chain_extensions()
338.    */
339.   
340. > static int check_chain_extensions(X509_STORE_CTX *ctx)
341.   {
342.       int i, ok = 0, must_be_ca, plen = 0;

crypto/x509/x509_vfy.c:342:5: 
340.   static int check_chain_extensions(X509_STORE_CTX *ctx)
341.   {
342. >     int i, ok = 0, must_be_ca, plen = 0;
343.       X509 *x;
344.       int (*cb) (int xok, X509_STORE_CTX *xctx);

crypto/x509/x509_vfy.c:345:5: 
343.       X509 *x;
344.       int (*cb) (int xok, X509_STORE_CTX *xctx);
345. >     int proxy_path_length = 0;
346.       int purpose;
347.       int allow_proxy_certs;

crypto/x509/x509_vfy.c:348:5: 
346.       int purpose;
347.       int allow_proxy_certs;
348. >     cb = ctx->verify_cb;
349.   
350.       /*-

crypto/x509/x509_vfy.c:359:5: 
357.        *     all certificates in the chain except the leaf certificate.
358.        */
359. >     must_be_ca = -1;
360.   
361.       /* CRL path validation */

crypto/x509/x509_vfy.c:362:9: Taking false branch
360.   
361.       /* CRL path validation */
362.       if (ctx->parent) {
               ^
363.           allow_proxy_certs = 0;
364.           purpose = X509_PURPOSE_CRL_SIGN;

crypto/x509/x509_vfy.c:367:17: Condition is true
365.       } else {
366.           allow_proxy_certs =
367.               ! !(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
                       ^
368.           /*
369.            * A hack to keep people who don't want to modify their software

crypto/x509/x509_vfy.c:367:13: 
365.       } else {
366.           allow_proxy_certs =
367. >             ! !(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
368.           /*
369.            * A hack to keep people who don't want to modify their software

crypto/x509/x509_vfy.c:366:9: 
364.           purpose = X509_PURPOSE_CRL_SIGN;
365.       } else {
366. >         allow_proxy_certs =
367.               ! !(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
368.           /*

crypto/x509/x509_vfy.c:372:13: Taking false branch
370.            * happy
371.            */
372.           if (getenv("OPENSSL_ALLOW_PROXY_CERTS"))
                   ^
373.               allow_proxy_certs = 1;
374.           purpose = ctx->param->purpose;

crypto/x509/x509_vfy.c:374:9: 
372.           if (getenv("OPENSSL_ALLOW_PROXY_CERTS"))
373.               allow_proxy_certs = 1;
374. >         purpose = ctx->param->purpose;
375.       }
376.   

crypto/x509/x509_vfy.c:378:10: 
376.   
377.       /* Check all untrusted certificates */
378. >     for (i = 0; i == 0 || i < ctx->num_untrusted; i++) {
379.           int ret;
380.           x = sk_X509_value(ctx->chain, i);

crypto/x509/x509_vfy.c:378:17: Loop condition is true. Entering loop body
376.   
377.       /* Check all untrusted certificates */
378.       for (i = 0; i == 0 || i < ctx->num_untrusted; i++) {
                       ^
379.           int ret;
380.           x = sk_X509_value(ctx->chain, i);

crypto/x509/x509_vfy.c:380:13: Condition is true
378.       for (i = 0; i == 0 || i < ctx->num_untrusted; i++) {
379.           int ret;
380.           x = sk_X509_value(ctx->chain, i);
                   ^
381.           if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
382.               && (x->ex_flags & EXFLAG_CRITICAL)) {

crypto/x509/x509_vfy.c:380:9: 
378.       for (i = 0; i == 0 || i < ctx->num_untrusted; i++) {
379.           int ret;
380. >         x = sk_X509_value(ctx->chain, i);
381.           if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
382.               && (x->ex_flags & EXFLAG_CRITICAL)) {

crypto/stack/stack.c:324:1: start of procedure sk_value()
  322.   }
  323.   
  324. > void *sk_value(const _STACK *st, int i)
  325.   {
  326.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:326:10: Taking false branch
  324.   void *sk_value(const _STACK *st, int i)
  325.   {
  326.       if (!st || (i < 0) || (i >= st->num))
                  ^
  327.           return NULL;
  328.       return st->data[i];

crypto/stack/stack.c:326:17: Taking false branch
  324.   void *sk_value(const _STACK *st, int i)
  325.   {
  326.       if (!st || (i < 0) || (i >= st->num))
                         ^
  327.           return NULL;
  328.       return st->data[i];

crypto/stack/stack.c:326:28: Taking true branch
  324.   void *sk_value(const _STACK *st, int i)
  325.   {
  326.       if (!st || (i < 0) || (i >= st->num))
                                    ^
  327.           return NULL;
  328.       return st->data[i];

crypto/stack/stack.c:327:9: 
  325.   {
  326.       if (!st || (i < 0) || (i >= st->num))
  327. >         return NULL;
  328.       return st->data[i];
  329.   }

crypto/stack/stack.c:329:1: return from a call to sk_value
  327.           return NULL;
  328.       return st->data[i];
  329. > }
  330.   
  331.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_vfy.c:381:15: Taking true branch
379.           int ret;
380.           x = sk_X509_value(ctx->chain, i);
381.           if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
                     ^
382.               && (x->ex_flags & EXFLAG_CRITICAL)) {
383.               ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION;

crypto/x509/x509_vfy.c:382:17: 
380.           x = sk_X509_value(ctx->chain, i);
381.           if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
382. >             && (x->ex_flags & EXFLAG_CRITICAL)) {
383.               ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION;
384.               ctx->error_depth = i;
