crypto/asn1/d2i_r_pr.c:87: error: NULL_DEREFERENCE
  pointer `bs` last assigned on line 81 could be null and is dereferenced at line 87, column 6.
Showing all 34 steps of the trace


crypto/asn1/d2i_r_pr.c:78:1: start of procedure d2i_RSAPrivateKey()
76.   	}
77.   
78. > RSA *d2i_RSAPrivateKey(RSA **a, unsigned char **pp, long length)
79.   	{
80.   	int i=ASN1_R_PARSING;

crypto/asn1/d2i_r_pr.c:80:2: 
78.   RSA *d2i_RSAPrivateKey(RSA **a, unsigned char **pp, long length)
79.   	{
80. > 	int i=ASN1_R_PARSING;
81.   	ASN1_INTEGER *bs=NULL;
82.   	M_ASN1_D2I_vars(a,RSA *,RSA_new);

crypto/asn1/d2i_r_pr.c:81:2: 
79.   	{
80.   	int i=ASN1_R_PARSING;
81. > 	ASN1_INTEGER *bs=NULL;
82.   	M_ASN1_D2I_vars(a,RSA *,RSA_new);
83.   

crypto/asn1/d2i_r_pr.c:82:2: Taking false branch
80.   	int i=ASN1_R_PARSING;
81.   	ASN1_INTEGER *bs=NULL;
82.   	M_ASN1_D2I_vars(a,RSA *,RSA_new);
       ^
83.   
84.   	M_ASN1_D2I_Init();

crypto/asn1/d2i_r_pr.c:82:2: Taking false branch
80.   	int i=ASN1_R_PARSING;
81.   	ASN1_INTEGER *bs=NULL;
82.   	M_ASN1_D2I_vars(a,RSA *,RSA_new);
       ^
83.   
84.   	M_ASN1_D2I_Init();

crypto/asn1/d2i_r_pr.c:84:2: Condition is false
82.   	M_ASN1_D2I_vars(a,RSA *,RSA_new);
83.   
84.   	M_ASN1_D2I_Init();
       ^
85.   	M_ASN1_D2I_start_sequence();
86.   	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);

crypto/asn1/d2i_r_pr.c:85:2: 
83.   
84.   	M_ASN1_D2I_Init();
85. > 	M_ASN1_D2I_start_sequence();
86.   	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
87.   	if (bs->length == 0)

crypto/asn1/asn1_lib.c:280:1: start of procedure asn1_GetSequence()
  278.   	}
  279.   
  280. > int asn1_GetSequence(ASN1_CTX *c, long *length)
  281.   	{
  282.   	unsigned char *q;

crypto/asn1/asn1_lib.c:284:2: 
  282.   	unsigned char *q;
  283.   
  284. > 	q=c->p;
  285.   	c->inf=ASN1_get_object(&(c->p),&(c->slen),&(c->tag),&(c->xclass),
  286.   		*length);

crypto/asn1/asn1_lib.c:285:2: Skipping ASN1_get_object(): empty list of specs
  283.   
  284.   	q=c->p;
  285.   	c->inf=ASN1_get_object(&(c->p),&(c->slen),&(c->tag),&(c->xclass),
          ^
  286.   		*length);
  287.   	if (c->inf & 0x80)

crypto/asn1/asn1_lib.c:287:6: Taking false branch
  285.   	c->inf=ASN1_get_object(&(c->p),&(c->slen),&(c->tag),&(c->xclass),
  286.   		*length);
  287.   	if (c->inf & 0x80)
              ^
  288.   		{
  289.   		c->error=ERR_R_BAD_GET_ASN1_OBJECT_CALL;

crypto/asn1/asn1_lib.c:292:6: Taking false branch
  290.   		return(0);
  291.   		}
  292.   	if (c->tag != V_ASN1_SEQUENCE)
              ^
  293.   		{
  294.   		c->error=ERR_R_EXPECTING_AN_ASN1_SEQUENCE;

crypto/asn1/asn1_lib.c:297:2: 
  295.   		return(0);
  296.   		}
  297. > 	(*length)-=(c->p-q);
  298.   	if (c->max && (*length < 0))
  299.   		{

crypto/asn1/asn1_lib.c:298:6: Taking true branch
  296.   		}
  297.   	(*length)-=(c->p-q);
  298.   	if (c->max && (*length < 0))
              ^
  299.   		{
  300.   		c->error=ERR_R_ASN1_LENGTH_MISMATCH;

crypto/asn1/asn1_lib.c:298:17: Taking false branch
  296.   		}
  297.   	(*length)-=(c->p-q);
  298.   	if (c->max && (*length < 0))
                         ^
  299.   		{
  300.   		c->error=ERR_R_ASN1_LENGTH_MISMATCH;

crypto/asn1/asn1_lib.c:303:6: Taking true branch
  301.   		return(0);
  302.   		}
  303.   	if (c->inf == (1|V_ASN1_CONSTRUCTED))
              ^
  304.   		c->slen= *length+ *(c->pp)-c->p;
  305.   	c->eos=0;

crypto/asn1/asn1_lib.c:304:3: 
  302.   		}
  303.   	if (c->inf == (1|V_ASN1_CONSTRUCTED))
  304. > 		c->slen= *length+ *(c->pp)-c->p;
  305.   	c->eos=0;
  306.   	return(1);

crypto/asn1/asn1_lib.c:305:2: 
  303.   	if (c->inf == (1|V_ASN1_CONSTRUCTED))
  304.   		c->slen= *length+ *(c->pp)-c->p;
  305. > 	c->eos=0;
  306.   	return(1);
  307.   	}

crypto/asn1/asn1_lib.c:306:2: 
  304.   		c->slen= *length+ *(c->pp)-c->p;
  305.   	c->eos=0;
  306. > 	return(1);
  307.   	}
  308.   

crypto/asn1/asn1_lib.c:307:2: return from a call to asn1_GetSequence
  305.   	c->eos=0;
  306.   	return(1);
  307.   	}
          ^
  308.   
  309.   ASN1_STRING *ASN1_STRING_dup(ASN1_STRING *str)

crypto/asn1/d2i_r_pr.c:85:2: Taking false branch
83.   
84.   	M_ASN1_D2I_Init();
85.   	M_ASN1_D2I_start_sequence();
       ^
86.   	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
87.   	if (bs->length == 0)

crypto/asn1/d2i_r_pr.c:86:2: 
84.   	M_ASN1_D2I_Init();
85.   	M_ASN1_D2I_start_sequence();
86. > 	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
87.   	if (bs->length == 0)
88.   		ret->version=0;

crypto/asn1/a_int.c:177:1: start of procedure d2i_ASN1_INTEGER()
  175.   
  176.   /* Convert DER encoded ASN1 INTEGER to ASN1_INTEGER structure */
  177. > ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a, unsigned char **pp,
  178.   	     long length)
  179.   {

crypto/asn1/a_int.c:186:2: 
  184.   	ASN1_INTEGER *ret;
  185.   
  186. > 	p= *pp;
  187.   	inf=ASN1_get_object(&p,&len,&tag,&xclass,length);
  188.   	if (inf & 0x80)

crypto/asn1/a_int.c:187:2: Skipping ASN1_get_object(): empty list of specs
  185.   
  186.   	p= *pp;
  187.   	inf=ASN1_get_object(&p,&len,&tag,&xclass,length);
          ^
  188.   	if (inf & 0x80)
  189.   		{

crypto/asn1/a_int.c:188:6: Taking false branch
  186.   	p= *pp;
  187.   	inf=ASN1_get_object(&p,&len,&tag,&xclass,length);
  188.   	if (inf & 0x80)
              ^
  189.   		{
  190.   		i=ASN1_R_BAD_OBJECT_HEADER;

crypto/asn1/a_int.c:194:6: Taking false branch
  192.   		}
  193.   
  194.   	if (tag != V_ASN1_INTEGER)
              ^
  195.   		{
  196.   		i=ASN1_R_EXPECTING_AN_INTEGER;

crypto/asn1/a_int.c:199:2: Skipping c2i_ASN1_INTEGER(): empty list of specs
  197.   		goto err;
  198.   		}
  199.   	ret = c2i_ASN1_INTEGER(a, &p, len);
          ^
  200.   	if(ret) *pp = p;
  201.   	return ret;

crypto/asn1/a_int.c:200:5: Taking true branch
  198.   		}
  199.   	ret = c2i_ASN1_INTEGER(a, &p, len);
  200.   	if(ret) *pp = p;
             ^
  201.   	return ret;
  202.   err:

crypto/asn1/a_int.c:200:10: 
  198.   		}
  199.   	ret = c2i_ASN1_INTEGER(a, &p, len);
  200. > 	if(ret) *pp = p;
  201.   	return ret;
  202.   err:

crypto/asn1/a_int.c:201:2: 
  199.   	ret = c2i_ASN1_INTEGER(a, &p, len);
  200.   	if(ret) *pp = p;
  201. > 	return ret;
  202.   err:
  203.   	ASN1err(ASN1_F_D2I_ASN1_INTEGER,i);

crypto/asn1/a_int.c:206:1: return from a call to d2i_ASN1_INTEGER
  204.   	return(NULL);
  205.   
  206. > }
  207.   
  208.   

crypto/asn1/d2i_r_pr.c:86:2: Taking false branch
84.   	M_ASN1_D2I_Init();
85.   	M_ASN1_D2I_start_sequence();
86.   	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
       ^
87.   	if (bs->length == 0)
88.   		ret->version=0;

crypto/asn1/d2i_r_pr.c:87:6: 
85.   	M_ASN1_D2I_start_sequence();
86.   	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
87. > 	if (bs->length == 0)
88.   		ret->version=0;
89.   	else	ret->version=bs->data[0];

RSA *d2i_RSAPrivateKey(RSA **a, unsigned char **pp, long length)
	{
	int i=ASN1_R_PARSING;
	ASN1_INTEGER *bs=NULL;
	M_ASN1_D2I_vars(a,RSA *,RSA_new);
	M_ASN1_D2I_Init();
	M_ASN1_D2I_start_sequence();
	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
	if (bs->length == 0)
		ret->version=0;
	else	ret->version=bs->data[0];
	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
	if ((ret->n=BN_bin2bn(bs->data,bs->length,ret->n)) == NULL) goto err_bn;
	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
	if ((ret->e=BN_bin2bn(bs->data,bs->length,ret->e)) == NULL) goto err_bn;
	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
	if ((ret->d=BN_bin2bn(bs->data,bs->length,ret->d)) == NULL) goto err_bn;
	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
	if ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) goto err_bn;
	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
	if ((ret->q=BN_bin2bn(bs->data,bs->length,ret->q)) == NULL) goto err_bn;
	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
	if ((ret->dmp1=BN_bin2bn(bs->data,bs->length,ret->dmp1)) == NULL)
		goto err_bn;
	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
	if ((ret->dmq1=BN_bin2bn(bs->data,bs->length,ret->dmq1)) == NULL)
		goto err_bn;
	M_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);
	if ((ret->iqmp=BN_bin2bn(bs->data,bs->length,ret->iqmp)) == NULL)
		goto err_bn;
	M_ASN1_INTEGER_free(bs);
	M_ASN1_D2I_Finish_2(a);
err_bn:
	i=ERR_R_BN_LIB;
err:
	ASN1err(ASN1_F_D2I_RSAPRIVATEKEY,i);
	if ((ret != NULL) && ((a == NULL) || (*a != ret))) RSA_free(ret);
	if (bs != NULL) M_ASN1_INTEGER_free(bs);
	return(NULL);
	}
['RSA *d2i_RSAPrivateKey(RSA **a, unsigned char **pp, long length)\n\t{\n\tint i=ASN1_R_PARSING;\n\tASN1_INTEGER *bs=NULL;\n\tM_ASN1_D2I_vars(a,RSA *,RSA_new);\n\tM_ASN1_D2I_Init();\n\tM_ASN1_D2I_start_sequence();\n\tM_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);\n\tif (bs->length == 0)\n\t\tret->version=0;\n\telse\tret->version=bs->data[0];\n\tM_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);\n\tif ((ret->n=BN_bin2bn(bs->data,bs->length,ret->n)) == NULL) goto err_bn;\n\tM_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);\n\tif ((ret->e=BN_bin2bn(bs->data,bs->length,ret->e)) == NULL) goto err_bn;\n\tM_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);\n\tif ((ret->d=BN_bin2bn(bs->data,bs->length,ret->d)) == NULL) goto err_bn;\n\tM_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);\n\tif ((ret->p=BN_bin2bn(bs->data,bs->length,ret->p)) == NULL) goto err_bn;\n\tM_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);\n\tif ((ret->q=BN_bin2bn(bs->data,bs->length,ret->q)) == NULL) goto err_bn;\n\tM_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);\n\tif ((ret->dmp1=BN_bin2bn(bs->data,bs->length,ret->dmp1)) == NULL)\n\t\tgoto err_bn;\n\tM_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);\n\tif ((ret->dmq1=BN_bin2bn(bs->data,bs->length,ret->dmq1)) == NULL)\n\t\tgoto err_bn;\n\tM_ASN1_D2I_get(bs,d2i_ASN1_INTEGER);\n\tif ((ret->iqmp=BN_bin2bn(bs->data,bs->length,ret->iqmp)) == NULL)\n\t\tgoto err_bn;\n\tM_ASN1_INTEGER_free(bs);\n\tM_ASN1_D2I_Finish_2(a);\nerr_bn:\n\ti=ERR_R_BN_LIB;\nerr:\n\tASN1err(ASN1_F_D2I_RSAPRIVATEKEY,i);\n\tif ((ret != NULL) && ((a == NULL) || (*a != ret))) RSA_free(ret);\n\tif (bs != NULL) M_ASN1_INTEGER_free(bs);\n\treturn(NULL);\n\t}', 'int asn1_GetSequence(ASN1_CTX *c, long *length)\n\t{\n\tunsigned char *q;\n\tq=c->p;\n\tc->inf=ASN1_get_object(&(c->p),&(c->slen),&(c->tag),&(c->xclass),\n\t\t*length);\n\tif (c->inf & 0x80)\n\t\t{\n\t\tc->error=ERR_R_BAD_GET_ASN1_OBJECT_CALL;\n\t\treturn(0);\n\t\t}\n\tif (c->tag != V_ASN1_SEQUENCE)\n\t\t{\n\t\tc->error=ERR_R_EXPECTING_AN_ASN1_SEQUENCE;\n\t\treturn(0);\n\t\t}\n\t(*length)-=(c->p-q);\n\tif (c->max && (*length < 0))\n\t\t{\n\t\tc->error=ERR_R_ASN1_LENGTH_MISMATCH;\n\t\treturn(0);\n\t\t}\n\tif (c->inf == (1|V_ASN1_CONSTRUCTED))\n\t\tc->slen= *length+ *(c->pp)-c->p;\n\tc->eos=0;\n\treturn(1);\n\t}', 'ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a, unsigned char **pp,\n\t     long length)\n{\n\tunsigned char *p;\n\tlong len;\n\tint i;\n\tint inf,tag,xclass;\n\tASN1_INTEGER *ret;\n\tp= *pp;\n\tinf=ASN1_get_object(&p,&len,&tag,&xclass,length);\n\tif (inf & 0x80)\n\t\t{\n\t\ti=ASN1_R_BAD_OBJECT_HEADER;\n\t\tgoto err;\n\t\t}\n\tif (tag != V_ASN1_INTEGER)\n\t\t{\n\t\ti=ASN1_R_EXPECTING_AN_INTEGER;\n\t\tgoto err;\n\t\t}\n\tret = c2i_ASN1_INTEGER(a, &p, len);\n\tif(ret) *pp = p;\n\treturn ret;\nerr:\n\tASN1err(ASN1_F_D2I_ASN1_INTEGER,i);\n\treturn(NULL);\n}']