crypto/asn1/tasn_dec.c:234: error: UNINITIALIZED_VALUE
  The value read from tt was never initialized.
Showing all 1 steps of the trace


crypto/asn1/tasn_dec.c:234:5: 
232.   		if(!*pval) {
233.   			if(!ASN1_item_ex_new(pval, it)) {
234. > 				errtt = tt;
235.   				ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
236.   				goto err;

int ASN1_item_ex_d2i(ASN1_VALUE **pval, unsigned char **in, long len, const ASN1_ITEM *it,
				int tag, int aclass, char opt, ASN1_TLC *ctx)
{
	const ASN1_TEMPLATE *tt, *errtt = NULL;
	const ASN1_COMPAT_FUNCS *cf;
	const ASN1_EXTERN_FUNCS *ef;
	const ASN1_AUX *aux = it->funcs;
	ASN1_aux_cb *asn1_cb;
	unsigned char *p, *q, imphack = 0, oclass;
	char seq_eoc, seq_nolen, cst, isopt;
	long tmplen;
	int i;
	int otag;
	int ret = 0;
	ASN1_VALUE *pchval, **pchptr, *ptmpval;
	if(!pval) return 0;
	if(aux && aux->asn1_cb) asn1_cb = aux->asn1_cb;
	else asn1_cb = 0;
	switch(it->itype) {
		case ASN1_ITYPE_PRIMITIVE:
		if(it->templates) {
			if ((tag != -1) || opt) {
				ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE);
				goto err;
			}
			return asn1_template_ex_d2i(pval, in, len, it->templates, opt, ctx);
		}
		return asn1_d2i_ex_primitive(pval, in, len, it, tag, aclass, opt, ctx);
		break;
		case ASN1_ITYPE_MSTRING:
		p = *in;
		ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, &p, len, -1, 0, 1, ctx);
		if(!ret) {
			ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
			goto err;
		}
		if(oclass != V_ASN1_UNIVERSAL) {
			if(opt) return -1;
			ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_MSTRING_NOT_UNIVERSAL);
			goto err;
		}
		if(!(ASN1_tag2bit(otag) & it->utype)) {
			if(opt) return -1;
			ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_MSTRING_WRONG_TAG);
			goto err;
		}
		return asn1_d2i_ex_primitive(pval, in, len, it, otag, 0, 0, ctx);
		case ASN1_ITYPE_EXTERN:
		ef = it->funcs;
		return ef->asn1_ex_d2i(pval, in, len, it, tag, aclass, opt, ctx);
		case ASN1_ITYPE_COMPAT:
		cf = it->funcs;
		if(opt) {
			int exptag;
			p = *in;
			if(tag == -1) exptag = it->utype;
			else exptag = tag;
			ret = asn1_check_tlen(NULL, NULL, NULL, NULL, NULL, &p, len, exptag, aclass, 1, ctx);
			if(!ret) {
				ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
				goto err;
			}
			if(ret == -1) return -1;
		}
		if(tag != -1) {
			p = *in;
			imphack = *p;
			*p = (unsigned char)((*p & V_ASN1_CONSTRUCTED) | it->utype);
		}
		ptmpval = cf->asn1_d2i(pval, in, len);
		if(tag != -1) *p = imphack;
		if(ptmpval) return 1;
		ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
		goto err;
		case ASN1_ITYPE_CHOICE:
		if(asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it))
				goto auxerr;
		if(!*pval) {
			if(!ASN1_item_ex_new(pval, it)) {
				errtt = tt;
				ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
				goto err;
			}
		}
		pchval = NULL;
		p = *in;
		for(i = 0, tt=it->templates; i < it->tcount; i++, tt++) {
			pchptr = asn1_get_field_ptr(pval, tt);
			ret = asn1_template_ex_d2i(pchptr, &p, len, tt, 1, ctx);
			if(ret == -1) continue;
			if(ret > 0) break;
			errtt = tt;
			ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
			goto err;
		}
		if(i == it->tcount) {
			if(opt) {
				ASN1_item_ex_free(pval, it);
				return -1;
			}
			ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_NO_MATCHING_CHOICE_TYPE);
			goto err;
		}
		asn1_set_choice_selector(pval, i, it);
		*in = p;
		if(asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it))
				goto auxerr;
		return 1;
		case ASN1_ITYPE_SEQUENCE:
		p = *in;
		tmplen = len;
		if(tag == -1) {
			tag = V_ASN1_SEQUENCE;
			aclass = V_ASN1_UNIVERSAL;
		}
		ret = asn1_check_tlen(&len, NULL, NULL, &seq_eoc, &cst, &p, len, tag, aclass, opt, ctx);
		if(!ret) {
			ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
			goto err;
		} else if(ret == -1) return -1;
		if(aux && (aux->flags & ASN1_AFLG_BROKEN)) {
			len = tmplen - (p - *in);
			seq_nolen = 1;
		} else seq_nolen = seq_eoc;
		if(!cst) {
			ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_SEQUENCE_NOT_CONSTRUCTED);
			goto err;
		}
		if(!*pval) {
			if(!ASN1_item_ex_new(pval, it)) {
				ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
				goto err;
			}
		}
		if(asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it))
				goto auxerr;
		for(i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
			const ASN1_TEMPLATE *seqtt;
			ASN1_VALUE **pseqval;
			seqtt = asn1_do_adb(pval, tt, 1);
			if(!seqtt) goto err;
			pseqval = asn1_get_field_ptr(pval, seqtt);
			if(!len) break;
			q = p;
			if(asn1_check_eoc(&p, len)) {
				if(!seq_eoc) {
					ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_UNEXPECTED_EOC);
					goto err;
				}
				len -= p - q;
				seq_eoc = 0;
				q = p;
				break;
			}
			if(i == (it->tcount - 1)) isopt = 0;
			else isopt = (char)(seqtt->flags & ASN1_TFLG_OPTIONAL);
			ret = asn1_template_ex_d2i(pseqval, &p, len, seqtt, isopt, ctx);
			if(!ret) {
				errtt = seqtt;
				goto err;
			} else if(ret == -1) {
				ASN1_template_free(pseqval, seqtt);
				continue;
			}
			len -= p - q;
		}
		if(seq_eoc && !asn1_check_eoc(&p, len)) {
			ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_MISSING_EOC);
			goto err;
		}
		if(!seq_nolen && len) {
			ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_SEQUENCE_LENGTH_MISMATCH);
			goto err;
		}
		for(; i < it->tcount; tt++, i++) {
			const ASN1_TEMPLATE *seqtt;
			seqtt = asn1_do_adb(pval, tt, 1);
			if(!seqtt) goto err;
			if(seqtt->flags & ASN1_TFLG_OPTIONAL) {
				ASN1_VALUE **pseqval;
				pseqval = asn1_get_field_ptr(pval, seqtt);
				ASN1_template_free(pseqval, seqtt);
			} else {
				errtt = seqtt;
				ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_FIELD_MISSING);
				goto err;
			}
		}
		if(!asn1_enc_save(pval, *in, p - *in, it)) goto auxerr;
		*in = p;
		if(asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it))
				goto auxerr;
		return 1;
		default:
		return 0;
	}
	auxerr:
	ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_AUX_ERROR);
	err:
	ASN1_item_ex_free(pval, it);
	if(errtt) ERR_add_error_data(4, "Field=", errtt->field_name, ", Type=", it->sname);
	else ERR_add_error_data(2, "Type=", it->sname);
	return 0;
}
['int ASN1_item_ex_d2i(ASN1_VALUE **pval, unsigned char **in, long len, const ASN1_ITEM *it,\n\t\t\t\tint tag, int aclass, char opt, ASN1_TLC *ctx)\n{\n\tconst ASN1_TEMPLATE *tt, *errtt = NULL;\n\tconst ASN1_COMPAT_FUNCS *cf;\n\tconst ASN1_EXTERN_FUNCS *ef;\n\tconst ASN1_AUX *aux = it->funcs;\n\tASN1_aux_cb *asn1_cb;\n\tunsigned char *p, *q, imphack = 0, oclass;\n\tchar seq_eoc, seq_nolen, cst, isopt;\n\tlong tmplen;\n\tint i;\n\tint otag;\n\tint ret = 0;\n\tASN1_VALUE *pchval, **pchptr, *ptmpval;\n\tif(!pval) return 0;\n\tif(aux && aux->asn1_cb) asn1_cb = aux->asn1_cb;\n\telse asn1_cb = 0;\n\tswitch(it->itype) {\n\t\tcase ASN1_ITYPE_PRIMITIVE:\n\t\tif(it->templates) {\n\t\t\tif ((tag != -1) || opt) {\n\t\t\t\tASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE);\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t\treturn asn1_template_ex_d2i(pval, in, len, it->templates, opt, ctx);\n\t\t}\n\t\treturn asn1_d2i_ex_primitive(pval, in, len, it, tag, aclass, opt, ctx);\n\t\tbreak;\n\t\tcase ASN1_ITYPE_MSTRING:\n\t\tp = *in;\n\t\tret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, &p, len, -1, 0, 1, ctx);\n\t\tif(!ret) {\n\t\t\tASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);\n\t\t\tgoto err;\n\t\t}\n\t\tif(oclass != V_ASN1_UNIVERSAL) {\n\t\t\tif(opt) return -1;\n\t\t\tASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_MSTRING_NOT_UNIVERSAL);\n\t\t\tgoto err;\n\t\t}\n\t\tif(!(ASN1_tag2bit(otag) & it->utype)) {\n\t\t\tif(opt) return -1;\n\t\t\tASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_MSTRING_WRONG_TAG);\n\t\t\tgoto err;\n\t\t}\n\t\treturn asn1_d2i_ex_primitive(pval, in, len, it, otag, 0, 0, ctx);\n\t\tcase ASN1_ITYPE_EXTERN:\n\t\tef = it->funcs;\n\t\treturn ef->asn1_ex_d2i(pval, in, len, it, tag, aclass, opt, ctx);\n\t\tcase ASN1_ITYPE_COMPAT:\n\t\tcf = it->funcs;\n\t\tif(opt) {\n\t\t\tint exptag;\n\t\t\tp = *in;\n\t\t\tif(tag == -1) exptag = it->utype;\n\t\t\telse exptag = tag;\n\t\t\tret = asn1_check_tlen(NULL, NULL, NULL, NULL, NULL, &p, len, exptag, aclass, 1, ctx);\n\t\t\tif(!ret) {\n\t\t\t\tASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t\tif(ret == -1) return -1;\n\t\t}\n\t\tif(tag != -1) {\n\t\t\tp = *in;\n\t\t\timphack = *p;\n\t\t\t*p = (unsigned char)((*p & V_ASN1_CONSTRUCTED) | it->utype);\n\t\t}\n\t\tptmpval = cf->asn1_d2i(pval, in, len);\n\t\tif(tag != -1) *p = imphack;\n\t\tif(ptmpval) return 1;\n\t\tASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);\n\t\tgoto err;\n\t\tcase ASN1_ITYPE_CHOICE:\n\t\tif(asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it))\n\t\t\t\tgoto auxerr;\n\t\tif(!*pval) {\n\t\t\tif(!ASN1_item_ex_new(pval, it)) {\n\t\t\t\terrtt = tt;\n\t\t\t\tASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t}\n\t\tpchval = NULL;\n\t\tp = *in;\n\t\tfor(i = 0, tt=it->templates; i < it->tcount; i++, tt++) {\n\t\t\tpchptr = asn1_get_field_ptr(pval, tt);\n\t\t\tret = asn1_template_ex_d2i(pchptr, &p, len, tt, 1, ctx);\n\t\t\tif(ret == -1) continue;\n\t\t\tif(ret > 0) break;\n\t\t\terrtt = tt;\n\t\t\tASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);\n\t\t\tgoto err;\n\t\t}\n\t\tif(i == it->tcount) {\n\t\t\tif(opt) {\n\t\t\t\tASN1_item_ex_free(pval, it);\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_NO_MATCHING_CHOICE_TYPE);\n\t\t\tgoto err;\n\t\t}\n\t\tasn1_set_choice_selector(pval, i, it);\n\t\t*in = p;\n\t\tif(asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it))\n\t\t\t\tgoto auxerr;\n\t\treturn 1;\n\t\tcase ASN1_ITYPE_SEQUENCE:\n\t\tp = *in;\n\t\ttmplen = len;\n\t\tif(tag == -1) {\n\t\t\ttag = V_ASN1_SEQUENCE;\n\t\t\taclass = V_ASN1_UNIVERSAL;\n\t\t}\n\t\tret = asn1_check_tlen(&len, NULL, NULL, &seq_eoc, &cst, &p, len, tag, aclass, opt, ctx);\n\t\tif(!ret) {\n\t\t\tASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);\n\t\t\tgoto err;\n\t\t} else if(ret == -1) return -1;\n\t\tif(aux && (aux->flags & ASN1_AFLG_BROKEN)) {\n\t\t\tlen = tmplen - (p - *in);\n\t\t\tseq_nolen = 1;\n\t\t} else seq_nolen = seq_eoc;\n\t\tif(!cst) {\n\t\t\tASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_SEQUENCE_NOT_CONSTRUCTED);\n\t\t\tgoto err;\n\t\t}\n\t\tif(!*pval) {\n\t\t\tif(!ASN1_item_ex_new(pval, it)) {\n\t\t\t\tASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t}\n\t\tif(asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it))\n\t\t\t\tgoto auxerr;\n\t\tfor(i = 0, tt = it->templates; i < it->tcount; i++, tt++) {\n\t\t\tconst ASN1_TEMPLATE *seqtt;\n\t\t\tASN1_VALUE **pseqval;\n\t\t\tseqtt = asn1_do_adb(pval, tt, 1);\n\t\t\tif(!seqtt) goto err;\n\t\t\tpseqval = asn1_get_field_ptr(pval, seqtt);\n\t\t\tif(!len) break;\n\t\t\tq = p;\n\t\t\tif(asn1_check_eoc(&p, len)) {\n\t\t\t\tif(!seq_eoc) {\n\t\t\t\t\tASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_UNEXPECTED_EOC);\n\t\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\t\tlen -= p - q;\n\t\t\t\tseq_eoc = 0;\n\t\t\t\tq = p;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(i == (it->tcount - 1)) isopt = 0;\n\t\t\telse isopt = (char)(seqtt->flags & ASN1_TFLG_OPTIONAL);\n\t\t\tret = asn1_template_ex_d2i(pseqval, &p, len, seqtt, isopt, ctx);\n\t\t\tif(!ret) {\n\t\t\t\terrtt = seqtt;\n\t\t\t\tgoto err;\n\t\t\t} else if(ret == -1) {\n\t\t\t\tASN1_template_free(pseqval, seqtt);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tlen -= p - q;\n\t\t}\n\t\tif(seq_eoc && !asn1_check_eoc(&p, len)) {\n\t\t\tASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_MISSING_EOC);\n\t\t\tgoto err;\n\t\t}\n\t\tif(!seq_nolen && len) {\n\t\t\tASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_SEQUENCE_LENGTH_MISMATCH);\n\t\t\tgoto err;\n\t\t}\n\t\tfor(; i < it->tcount; tt++, i++) {\n\t\t\tconst ASN1_TEMPLATE *seqtt;\n\t\t\tseqtt = asn1_do_adb(pval, tt, 1);\n\t\t\tif(!seqtt) goto err;\n\t\t\tif(seqtt->flags & ASN1_TFLG_OPTIONAL) {\n\t\t\t\tASN1_VALUE **pseqval;\n\t\t\t\tpseqval = asn1_get_field_ptr(pval, seqtt);\n\t\t\t\tASN1_template_free(pseqval, seqtt);\n\t\t\t} else {\n\t\t\t\terrtt = seqtt;\n\t\t\t\tASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_FIELD_MISSING);\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t}\n\t\tif(!asn1_enc_save(pval, *in, p - *in, it)) goto auxerr;\n\t\t*in = p;\n\t\tif(asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it))\n\t\t\t\tgoto auxerr;\n\t\treturn 1;\n\t\tdefault:\n\t\treturn 0;\n\t}\n\tauxerr:\n\tASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_AUX_ERROR);\n\terr:\n\tASN1_item_ex_free(pval, it);\n\tif(errtt) ERR_add_error_data(4, "Field=", errtt->field_name, ", Type=", it->sname);\n\telse ERR_add_error_data(2, "Type=", it->sname);\n\treturn 0;\n}']