crypto/x509/x509_lu.c:467: error: NULL_DEREFERENCE
  pointer `&obj` last assigned on line 466 could be null and is dereferenced by call to `x509_object_cmp()` at line 467, column 7.
Showing all 19 steps of the trace


crypto/x509/x509_lu.c:457:1: start of procedure X509_OBJECT_retrieve_match()
455.   }
456.   
457. > X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x)
458.   {
459.   	int idx, i;

crypto/x509/x509_lu.c:461:2: Skipping sk_find(): empty list of specs
459.   	int idx, i;
460.   	X509_OBJECT *obj;
461.   	idx = sk_X509_OBJECT_find(h, x);
        ^
462.   	if (idx == -1) return NULL;
463.   	if (x->type != X509_LU_X509) return sk_X509_OBJECT_value(h, idx);

crypto/x509/x509_lu.c:462:6: Taking false branch
460.   	X509_OBJECT *obj;
461.   	idx = sk_X509_OBJECT_find(h, x);
462.   	if (idx == -1) return NULL;
            ^
463.   	if (x->type != X509_LU_X509) return sk_X509_OBJECT_value(h, idx);
464.   	for (i = idx; i < sk_X509_OBJECT_num(h); i++)

crypto/x509/x509_lu.c:463:6: Taking false branch
461.   	idx = sk_X509_OBJECT_find(h, x);
462.   	if (idx == -1) return NULL;
463.   	if (x->type != X509_LU_X509) return sk_X509_OBJECT_value(h, idx);
            ^
464.   	for (i = idx; i < sk_X509_OBJECT_num(h); i++)
465.   		{

crypto/x509/x509_lu.c:464:7: 
462.   	if (idx == -1) return NULL;
463.   	if (x->type != X509_LU_X509) return sk_X509_OBJECT_value(h, idx);
464. > 	for (i = idx; i < sk_X509_OBJECT_num(h); i++)
465.   		{
466.   		obj = sk_X509_OBJECT_value(h, i);

crypto/x509/x509_lu.c:464:16: 
462.   	if (idx == -1) return NULL;
463.   	if (x->type != X509_LU_X509) return sk_X509_OBJECT_value(h, idx);
464. > 	for (i = idx; i < sk_X509_OBJECT_num(h); i++)
465.   		{
466.   		obj = sk_X509_OBJECT_value(h, i);

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

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

crypto/stack/stack.c:303:17: 
  301.   int sk_num(const STACK *st)
  302.   {
  303. > 	if(st == NULL) return -1;
  304.   	return st->num;
  305.   }

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

crypto/x509/x509_lu.c:464:16: Loop condition is true. Entering loop body
462.   	if (idx == -1) return NULL;
463.   	if (x->type != X509_LU_X509) return sk_X509_OBJECT_value(h, idx);
464.   	for (i = idx; i < sk_X509_OBJECT_num(h); i++)
                      ^
465.   		{
466.   		obj = sk_X509_OBJECT_value(h, i);

crypto/x509/x509_lu.c:466:3: 
464.   	for (i = idx; i < sk_X509_OBJECT_num(h); i++)
465.   		{
466. > 		obj = sk_X509_OBJECT_value(h, i);
467.   		if (x509_object_cmp((const X509_OBJECT **)&obj, (const X509_OBJECT **)&x))
468.   			return NULL;

crypto/stack/stack.c:307:1: start of procedure sk_value()
  305.   }
  306.   
  307. > char *sk_value(const STACK *st, int i)
  308.   {
  309.   	if(st == NULL) return NULL;

crypto/stack/stack.c:309:5: Taking true branch
  307.   char *sk_value(const STACK *st, int i)
  308.   {
  309.   	if(st == NULL) return NULL;
             ^
  310.   	return st->data[i];
  311.   }

crypto/stack/stack.c:309:17: 
  307.   char *sk_value(const STACK *st, int i)
  308.   {
  309. > 	if(st == NULL) return NULL;
  310.   	return st->data[i];
  311.   }

crypto/stack/stack.c:311:1: return from a call to sk_value
  309.   	if(st == NULL) return NULL;
  310.   	return st->data[i];
  311. > }
  312.   
  313.   char *sk_set(STACK *st, int i, char *value)

crypto/x509/x509_lu.c:467:7: 
465.   		{
466.   		obj = sk_X509_OBJECT_value(h, i);
467. > 		if (x509_object_cmp((const X509_OBJECT **)&obj, (const X509_OBJECT **)&x))
468.   			return NULL;
469.   		if ((x->type != X509_LU_X509) || !X509_cmp(obj->data.x509, x->data.x509))

crypto/x509/x509_lu.c:157:1: start of procedure x509_object_cmp()
  155.   
  156.     
  157. > static int x509_object_cmp(const X509_OBJECT * const *a, const X509_OBJECT * const *b)
  158.     	{
  159.    	int ret;

crypto/x509/x509_lu.c:161:3: 
  159.    	int ret;
  160.   
  161. >  	ret=((*a)->type - (*b)->type);
  162.    	if (ret) return ret;
  163.    	switch ((*a)->type)

X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x)
{
	int idx, i;
	X509_OBJECT *obj;
	idx = sk_X509_OBJECT_find(h, x);
	if (idx == -1) return NULL;
	if (x->type != X509_LU_X509) return sk_X509_OBJECT_value(h, idx);
	for (i = idx; i < sk_X509_OBJECT_num(h); i++)
		{
		obj = sk_X509_OBJECT_value(h, i);
		if (x509_object_cmp((const X509_OBJECT **)&obj, (const X509_OBJECT **)&x))
			return NULL;
		if ((x->type != X509_LU_X509) || !X509_cmp(obj->data.x509, x->data.x509))
			return obj;
		}
	return NULL;
}
['X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x)\n{\n\tint idx, i;\n\tX509_OBJECT *obj;\n\tidx = sk_X509_OBJECT_find(h, x);\n\tif (idx == -1) return NULL;\n\tif (x->type != X509_LU_X509) return sk_X509_OBJECT_value(h, idx);\n\tfor (i = idx; i < sk_X509_OBJECT_num(h); i++)\n\t\t{\n\t\tobj = sk_X509_OBJECT_value(h, i);\n\t\tif (x509_object_cmp((const X509_OBJECT **)&obj, (const X509_OBJECT **)&x))\n\t\t\treturn NULL;\n\t\tif ((x->type != X509_LU_X509) || !X509_cmp(obj->data.x509, x->data.x509))\n\t\t\treturn obj;\n\t\t}\n\treturn NULL;\n}', 'int sk_num(const STACK *st)\n{\n\tif(st == NULL) return -1;\n\treturn st->num;\n}', 'char *sk_value(const STACK *st, int i)\n{\n\tif(st == NULL) return NULL;\n\treturn st->data[i];\n}', 'static int x509_object_cmp(const X509_OBJECT * const *a, const X509_OBJECT * const *b)\n  \t{\n \tint ret;\n \tret=((*a)->type - (*b)->type);\n \tif (ret) return ret;\n \tswitch ((*a)->type)\n \t\t{\n \tcase X509_LU_X509:\n \t\tret=X509_subject_name_cmp((*a)->data.x509,(*b)->data.x509);\n \t\tbreak;\n \tcase X509_LU_CRL:\n \t\tret=X509_CRL_cmp((*a)->data.crl,(*b)->data.crl);\n \t\tbreak;\n\tdefault:\n\t\treturn 0;\n\t\t}\n\treturn ret;\n\t}']