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


crypto/x509/x509_vfy.c:1291:1: start of procedure check_crl_chain()
1289.    */
1290.   
1291. > static int check_crl_chain(X509_STORE_CTX *ctx,
1292.   			STACK_OF(X509) *cert_path,
1293.   			STACK_OF(X509) *crl_path)

crypto/x509/x509_vfy.c:1296:12: Condition is true
1294.   	{
1295.   	X509 *cert_ta, *crl_ta;
1296.   	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
                   ^
1297.   	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
1298.   	if (!X509_cmp(cert_ta, crl_ta))

crypto/x509/x509_vfy.c:1296:12: Condition is true
1294.   	{
1295.   	X509 *cert_ta, *crl_ta;
1296.   	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
                   ^
1297.   	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
1298.   	if (!X509_cmp(cert_ta, crl_ta))

crypto/x509/x509_vfy.c:1296:2: 
1294.   	{
1295.   	X509 *cert_ta, *crl_ta;
1296. > 	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
1297.   	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
1298.   	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:1297:11: Condition is true
1295.   	X509 *cert_ta, *crl_ta;
1296.   	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
1297.   	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
                  ^
1298.   	if (!X509_cmp(cert_ta, crl_ta))
1299.   		return 1;

crypto/x509/x509_vfy.c:1297:11: Condition is true
1295.   	X509 *cert_ta, *crl_ta;
1296.   	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
1297.   	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
                  ^
1298.   	if (!X509_cmp(cert_ta, crl_ta))
1299.   		return 1;

crypto/x509/x509_vfy.c:1297:2: 
1295.   	X509 *cert_ta, *crl_ta;
1296.   	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
1297. > 	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
1298.   	if (!X509_cmp(cert_ta, crl_ta))
1299.   		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:1298:7: 
1296.   	cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
1297.   	crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
1298. > 	if (!X509_cmp(cert_ta, crl_ta))
1299.   		return 1;
1300.   	return 0;

crypto/x509/x509_cmp.c:179:1: start of procedure X509_cmp()
  177.    * with an evil cast.
  178.    */
  179. > int X509_cmp(const X509 *a, const X509 *b)
  180.   {
  181.   	/* ensure hash is valid */

crypto/x509/x509_cmp.c:182:2: Skipping X509_check_purpose(): empty list of specs
  180.   {
  181.   	/* ensure hash is valid */
  182.   	X509_check_purpose((X509 *)a, -1, 0);
          ^
  183.   	X509_check_purpose((X509 *)b, -1, 0);
  184.   

crypto/x509/x509_cmp.c:183:2: Skipping X509_check_purpose(): empty list of specs
  181.   	/* ensure hash is valid */
  182.   	X509_check_purpose((X509 *)a, -1, 0);
  183.   	X509_check_purpose((X509 *)b, -1, 0);
          ^
  184.   
  185.   	return memcmp(a->sha1_hash, b->sha1_hash, SHA_DIGEST_LENGTH);

crypto/x509/x509_cmp.c:185:2: 
  183.   	X509_check_purpose((X509 *)b, -1, 0);
  184.   
  185. > 	return memcmp(a->sha1_hash, b->sha1_hash, SHA_DIGEST_LENGTH);
  186.   }
  187.   #endif

crypto/x509/x509_cmp.c:186:1: return from a call to X509_cmp
  184.   
  185.   	return memcmp(a->sha1_hash, b->sha1_hash, SHA_DIGEST_LENGTH);
  186. > }
  187.   #endif
  188.   

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