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


crypto/x509/x509_vfy.c:1151:1: start of procedure check_crl_chain()
1149.    */
1150.   
1151. > static int check_crl_chain(X509_STORE_CTX *ctx,
1152.   			STACK_OF(X509) *cert_path,
1153.   			STACK_OF(X509) *crl_path)

crypto/x509/x509_vfy.c:1156:12: Condition is true
1154.   	{
1155.   	X509 *cert_ta, *crl_ta;
1156.   	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
                   ^
1157.   	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
1158.   	if (!X509_cmp(cert_ta, crl_ta))

crypto/x509/x509_vfy.c:1156:12: Condition is true
1154.   	{
1155.   	X509 *cert_ta, *crl_ta;
1156.   	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
                   ^
1157.   	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
1158.   	if (!X509_cmp(cert_ta, crl_ta))

crypto/x509/x509_vfy.c:1156:2: 
1154.   	{
1155.   	X509 *cert_ta, *crl_ta;
1156. > 	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
1157.   	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
1158.   	if (!X509_cmp(cert_ta, crl_ta))

crypto/stack/stack.c:294:1: start of procedure sk_num()
  292.   	}
  293.   
  294. > int sk_num(const _STACK *st)
  295.   {
  296.   	if(st == NULL) return -1;

crypto/stack/stack.c:296:5: Taking false branch
  294.   int sk_num(const _STACK *st)
  295.   {
  296.   	if(st == NULL) return -1;
             ^
  297.   	return st->num;
  298.   }

crypto/stack/stack.c:297:2: 
  295.   {
  296.   	if(st == NULL) return -1;
  297. > 	return st->num;
  298.   }
  299.   

crypto/stack/stack.c:298:1: return from a call to sk_num
  296.   	if(st == NULL) return -1;
  297.   	return st->num;
  298. > }
  299.   
  300.   void *sk_value(const _STACK *st, int i)

crypto/stack/stack.c:300:1: start of procedure sk_value()
  298.   }
  299.   
  300. > void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:302:6: Taking false branch
  300.   void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
              ^
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:302:13: Taking true branch
  300.   void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                     ^
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:302:39: 
  300.   void *sk_value(const _STACK *st, int i)
  301.   {
  302. > 	if(!st || (i < 0) || (i >= st->num)) return NULL;
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:304:1: return from a call to sk_value
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  303.   	return st->data[i];
  304. > }
  305.   
  306.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_vfy.c:1157:11: Condition is true
1155.   	X509 *cert_ta, *crl_ta;
1156.   	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
1157.   	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
                  ^
1158.   	if (!X509_cmp(cert_ta, crl_ta))
1159.   		return 1;

crypto/x509/x509_vfy.c:1157:11: Condition is true
1155.   	X509 *cert_ta, *crl_ta;
1156.   	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
1157.   	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
                  ^
1158.   	if (!X509_cmp(cert_ta, crl_ta))
1159.   		return 1;

crypto/x509/x509_vfy.c:1157:2: 
1155.   	X509 *cert_ta, *crl_ta;
1156.   	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
1157. > 	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
1158.   	if (!X509_cmp(cert_ta, crl_ta))
1159.   		return 1;

crypto/stack/stack.c:294:1: start of procedure sk_num()
  292.   	}
  293.   
  294. > int sk_num(const _STACK *st)
  295.   {
  296.   	if(st == NULL) return -1;

crypto/stack/stack.c:296:5: Taking false branch
  294.   int sk_num(const _STACK *st)
  295.   {
  296.   	if(st == NULL) return -1;
             ^
  297.   	return st->num;
  298.   }

crypto/stack/stack.c:297:2: 
  295.   {
  296.   	if(st == NULL) return -1;
  297. > 	return st->num;
  298.   }
  299.   

crypto/stack/stack.c:298:1: return from a call to sk_num
  296.   	if(st == NULL) return -1;
  297.   	return st->num;
  298. > }
  299.   
  300.   void *sk_value(const _STACK *st, int i)

crypto/stack/stack.c:300:1: start of procedure sk_value()
  298.   }
  299.   
  300. > void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:302:6: Taking false branch
  300.   void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
              ^
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:302:13: Taking false branch
  300.   void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                     ^
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:302:24: Taking false branch
  300.   void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                                ^
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:303:2: 
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  303. > 	return st->data[i];
  304.   }
  305.   

crypto/stack/stack.c:304:1: return from a call to sk_value
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  303.   	return st->data[i];
  304. > }
  305.   
  306.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_vfy.c:1158:7: 
1156.   	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
1157.   	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
1158. > 	if (!X509_cmp(cert_ta, crl_ta))
1159.   		return 1;
1160.   	return 0;

crypto/x509/x509_cmp.c:166:1: start of procedure X509_cmp()
  164.    * with an evil cast.
  165.    */
  166. > int X509_cmp(const X509 *a, const X509 *b)
  167.   {
  168.   	/* ensure hash is valid */

crypto/x509/x509_cmp.c:169:2: Skipping X509_check_purpose(): empty list of specs
  167.   {
  168.   	/* ensure hash is valid */
  169.   	X509_check_purpose((X509 *)a, -1, 0);
          ^
  170.   	X509_check_purpose((X509 *)b, -1, 0);
  171.   

crypto/x509/x509_cmp.c:170:2: Skipping X509_check_purpose(): empty list of specs
  168.   	/* ensure hash is valid */
  169.   	X509_check_purpose((X509 *)a, -1, 0);
  170.   	X509_check_purpose((X509 *)b, -1, 0);
          ^
  171.   
  172.   	return memcmp(a->sha1_hash, b->sha1_hash, SHA_DIGEST_LENGTH);

crypto/x509/x509_cmp.c:172:2: 
  170.   	X509_check_purpose((X509 *)b, -1, 0);
  171.   
  172. > 	return memcmp(a->sha1_hash, b->sha1_hash, SHA_DIGEST_LENGTH);
  173.   }
  174.   #endif

crypto/x509/x509_cmp.c:173:1: return from a call to X509_cmp
  171.   
  172.   	return memcmp(a->sha1_hash, b->sha1_hash, SHA_DIGEST_LENGTH);
  173. > }
  174.   #endif
  175.   

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}']