google / certificate-transparency

Auditing for TLS certificates.
https://certificate.transparency.dev
Apache License 2.0
869 stars 283 forks source link

Cert::OctetStringExtensionData crashes if extension is invalid #1442

Closed RJPercival closed 6 years ago

RJPercival commented 6 years ago

If the extension is invalid, the error code returned by ExtensionStructure() is FAILED_PRECONDITION, so the method continues until calling ext_struct.ValueOrDie(), resulting in a crash.

Originally, this check was !ext_struct.ok() || !ext_struct.ValueOrDie(), which correctly handled invalid extensions, but https://github.com/google/certificate-transparency/pull/949 changed this. Rather than just reverting this change, I've opted to: