Fix omitted selector handling. The selector field could be omitted because it has a DEFAULT value. In this case *sfld == NULL (sfld can never be NULL). This was not noticed because this was never used in existing ASN.1 modules. (Imported from upstream's c4210673313482edacede58d92e92c213d7a181a.) svaldez and I stared at this for a while and we believe this change is correct. It's also irrelevant because our only remaining ADB (ANY DEFINED BY) table is POLICYQUALINFO which does not allow its selector to be omitted. Also, if it did, it would be a slight change in behavior. We'd switch from using POLICYQUALINFO's default_tt (filling in an ASN1_ANY) to its null_tt (which doesn't exist, so error). Change-Id: If6a929e3dafca18431775b01958d0dae1c09f3b4 Reviewed-on: https://boringssl-review.googlesource.com/8943 Reviewed-by: Adam Langley <agl@google.com> Commit-Queue: Adam Langley <agl@google.com> CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
diff --git a/crypto/asn1/tasn_utl.c b/crypto/asn1/tasn_utl.c index 960cdbb..55037a1 100644 --- a/crypto/asn1/tasn_utl.c +++ b/crypto/asn1/tasn_utl.c
@@ -222,7 +222,7 @@ sfld = offset2ptr(*pval, adb->offset); /* Check if NULL */ - if (!sfld) { + if (*sfld == NULL) { if (!adb->null_tt) { goto err; }