From 628b3c7f2fdf68519c27dc087c400ca616616f4e Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Thu, 5 Apr 2018 19:43:34 -0400 Subject: [PATCH] Don't write out a bad OID If we don't have OID data for an object then we should fail if we are asked to encode the ASN.1 for that OID. (Imported from upstream's f3f8e72f494b36d05e0d04fe418f92b692fbb261.) Change-Id: I3c3d3a3b236bca374fde3c0d02504140f2992602 Reviewed-on: https://boringssl-review.googlesource.com/27065 Reviewed-by: Adam Langley Commit-Queue: David Benjamin CQ-Verified: CQ bot account: commit-bot@chromium.org --- crypto/asn1/tasn_enc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crypto/asn1/tasn_enc.c b/crypto/asn1/tasn_enc.c index cc87d349..d89ec8a7 100644 --- a/crypto/asn1/tasn_enc.c +++ b/crypto/asn1/tasn_enc.c @@ -583,6 +583,8 @@ int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype, otmp = (ASN1_OBJECT *)*pval; cont = otmp->data; len = otmp->length; + if (cont == NULL || len == 0) + return -1; break; case V_ASN1_NULL: