crypto/x509/x509_vfy.c:1153: error: NULL_DEREFERENCE
  pointer `cert_ta` last assigned on line 1151 could be null and is dereferenced by call to `X509_cmp()` at line 1153, column 7.
Showing all 32 steps of the trace


crypto/x509/x509_vfy.c:1146:1: start of procedure check_crl_chain()
1144.    */
1145.   
1146. > static int check_crl_chain(X509_STORE_CTX *ctx,
1147.   			STACK_OF(X509) *cert_path,
1148.   			STACK_OF(X509) *crl_path)

crypto/x509/x509_vfy.c:1151:12: Condition is true
1149.   	{
1150.   	X509 *cert_ta, *crl_ta;
1151.   	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
                   ^
1152.   	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
1153.   	if (!X509_cmp(cert_ta, crl_ta))

crypto/x509/x509_vfy.c:1151:12: Condition is true
1149.   	{
1150.   	X509 *cert_ta, *crl_ta;
1151.   	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
                   ^
1152.   	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
1153.   	if (!X509_cmp(cert_ta, crl_ta))

crypto/x509/x509_vfy.c:1151:2: 
1149.   	{
1150.   	X509 *cert_ta, *crl_ta;
1151. > 	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
1152.   	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
1153.   	if (!X509_cmp(cert_ta, crl_ta))

crypto/stack/stack.c:302:1: start of procedure sk_num()
  300.   	}
  301.   
  302. > int sk_num(const _STACK *st)
  303.   {
  304.   	if(st == NULL) return -1;

crypto/stack/stack.c:304:5: Taking false branch
  302.   int sk_num(const _STACK *st)
  303.   {
  304.   	if(st == NULL) return -1;
             ^
  305.   	return st->num;
  306.   }

crypto/stack/stack.c:305:2: 
  303.   {
  304.   	if(st == NULL) return -1;
  305. > 	return st->num;
  306.   }
  307.   

crypto/stack/stack.c:306:1: return from a call to sk_num
  304.   	if(st == NULL) return -1;
  305.   	return st->num;
  306. > }
  307.   
  308.   void *sk_value(const _STACK *st, int i)

crypto/stack/stack.c:308:1: start of procedure sk_value()
  306.   }
  307.   
  308. > void *sk_value(const _STACK *st, int i)
  309.   {
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:310:6: Taking false branch
  308.   void *sk_value(const _STACK *st, int i)
  309.   {
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
              ^
  311.   	return st->data[i];
  312.   }

crypto/stack/stack.c:310:13: Taking true branch
  308.   void *sk_value(const _STACK *st, int i)
  309.   {
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                     ^
  311.   	return st->data[i];
  312.   }

crypto/stack/stack.c:310:39: 
  308.   void *sk_value(const _STACK *st, int i)
  309.   {
  310. > 	if(!st || (i < 0) || (i >= st->num)) return NULL;
  311.   	return st->data[i];
  312.   }

crypto/stack/stack.c:312:1: return from a call to sk_value
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  311.   	return st->data[i];
  312. > }
  313.   
  314.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_vfy.c:1152:11: Condition is true
1150.   	X509 *cert_ta, *crl_ta;
1151.   	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
1152.   	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
                  ^
1153.   	if (!X509_cmp(cert_ta, crl_ta))
1154.   		return 1;

crypto/x509/x509_vfy.c:1152:11: Condition is true
1150.   	X509 *cert_ta, *crl_ta;
1151.   	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
1152.   	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
                  ^
1153.   	if (!X509_cmp(cert_ta, crl_ta))
1154.   		return 1;

crypto/x509/x509_vfy.c:1152:2: 
1150.   	X509 *cert_ta, *crl_ta;
1151.   	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
1152. > 	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
1153.   	if (!X509_cmp(cert_ta, crl_ta))
1154.   		return 1;

crypto/stack/stack.c:302:1: start of procedure sk_num()
  300.   	}
  301.   
  302. > int sk_num(const _STACK *st)
  303.   {
  304.   	if(st == NULL) return -1;

crypto/stack/stack.c:304:5: Taking false branch
  302.   int sk_num(const _STACK *st)
  303.   {
  304.   	if(st == NULL) return -1;
             ^
  305.   	return st->num;
  306.   }

crypto/stack/stack.c:305:2: 
  303.   {
  304.   	if(st == NULL) return -1;
  305. > 	return st->num;
  306.   }
  307.   

crypto/stack/stack.c:306:1: return from a call to sk_num
  304.   	if(st == NULL) return -1;
  305.   	return st->num;
  306. > }
  307.   
  308.   void *sk_value(const _STACK *st, int i)

crypto/stack/stack.c:308:1: start of procedure sk_value()
  306.   }
  307.   
  308. > void *sk_value(const _STACK *st, int i)
  309.   {
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:310:6: Taking false branch
  308.   void *sk_value(const _STACK *st, int i)
  309.   {
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
              ^
  311.   	return st->data[i];
  312.   }

crypto/stack/stack.c:310:13: Taking false branch
  308.   void *sk_value(const _STACK *st, int i)
  309.   {
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                     ^
  311.   	return st->data[i];
  312.   }

crypto/stack/stack.c:310:24: Taking false branch
  308.   void *sk_value(const _STACK *st, int i)
  309.   {
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                                ^
  311.   	return st->data[i];
  312.   }

crypto/stack/stack.c:311:2: 
  309.   {
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  311. > 	return st->data[i];
  312.   }
  313.   

crypto/stack/stack.c:312:1: return from a call to sk_value
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  311.   	return st->data[i];
  312. > }
  313.   
  314.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_vfy.c:1153:7: 
1151.   	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
1152.   	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
1153. > 	if (!X509_cmp(cert_ta, crl_ta))
1154.   		return 1;
1155.   	return 0;

crypto/x509/x509_cmp.c:161:1: start of procedure X509_cmp()
  159.    * with an evil cast.
  160.    */
  161. > int X509_cmp(const X509 *a, const X509 *b)
  162.   {
  163.   	/* ensure hash is valid */

crypto/x509/x509_cmp.c:164:2: Skipping X509_check_purpose(): empty list of specs
  162.   {
  163.   	/* ensure hash is valid */
  164.   	X509_check_purpose((X509 *)a, -1, 0);
          ^
  165.   	X509_check_purpose((X509 *)b, -1, 0);
  166.   

crypto/x509/x509_cmp.c:165:2: Skipping X509_check_purpose(): empty list of specs
  163.   	/* ensure hash is valid */
  164.   	X509_check_purpose((X509 *)a, -1, 0);
  165.   	X509_check_purpose((X509 *)b, -1, 0);
          ^
  166.   
  167.   	return memcmp(a->sha1_hash, b->sha1_hash, SHA_DIGEST_LENGTH);

crypto/x509/x509_cmp.c:167:2: 
  165.   	X509_check_purpose((X509 *)b, -1, 0);
  166.   
  167. > 	return memcmp(a->sha1_hash, b->sha1_hash, SHA_DIGEST_LENGTH);
  168.   }
  169.   #endif

crypto/x509/x509_cmp.c:168:1: return from a call to X509_cmp
  166.   
  167.   	return memcmp(a->sha1_hash, b->sha1_hash, SHA_DIGEST_LENGTH);
  168. > }
  169.   #endif
  170.   

static int check_crl_chain(X509_STORE_CTX *ctx,
			STACK_OF(X509) *cert_path,
			STACK_OF(X509) *crl_path)
	{
	X509 *cert_ta, *crl_ta;
	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
	if (!X509_cmp(cert_ta, crl_ta))
		return 1;
	return 0;
	}
['static int check_crl_chain(X509_STORE_CTX *ctx,\n\t\t\tSTACK_OF(X509) *cert_path,\n\t\t\tSTACK_OF(X509) *crl_path)\n\t{\n\tX509 *cert_ta, *crl_ta;\n\tcert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);\n\tcrl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);\n\tif (!X509_cmp(cert_ta, crl_ta))\n\t\treturn 1;\n\treturn 0;\n\t}', 'int sk_num(const _STACK *st)\n{\n\tif(st == NULL) return -1;\n\treturn st->num;\n}', 'void *sk_value(const _STACK *st, int i)\n{\n\tif(!st || (i < 0) || (i >= st->num)) return NULL;\n\treturn st->data[i];\n}', 'int X509_cmp(const X509 *a, const X509 *b)\n{\n\tX509_check_purpose((X509 *)a, -1, 0);\n\tX509_check_purpose((X509 *)b, -1, 0);\n\treturn memcmp(a->sha1_hash, b->sha1_hash, SHA_DIGEST_LENGTH);\n}']