diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2021-04-18 14:12:17 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-18 14:18:16 +0200 |
commit | ae491717558b5d218faedbbff9353df59b2269af (patch) | |
tree | 9fba856ef899c58c17fc687a93d892da20e18783 /Userland/Libraries/LibCrypto | |
parent | db8f0a2fa68b619471f480a3eb6f28054370f344 (diff) | |
download | serenity-ae491717558b5d218faedbbff9353df59b2269af.zip |
LibCrypto: Avoid creating bools from anything except bools
Diffstat (limited to 'Userland/Libraries/LibCrypto')
-rw-r--r-- | Userland/Libraries/LibCrypto/ASN1/DER.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Userland/Libraries/LibCrypto/ASN1/DER.h b/Userland/Libraries/LibCrypto/ASN1/DER.h index 1fbc960788..4ed44699ce 100644 --- a/Userland/Libraries/LibCrypto/ASN1/DER.h +++ b/Userland/Libraries/LibCrypto/ASN1/DER.h @@ -154,9 +154,13 @@ private: if (value_or_error.is_error()) return value_or_error.error(); - auto&& value = value_or_error.value(); - if constexpr (requires { ValueType { value }; }) - return ValueType { value }; + if constexpr (IsSame<ValueType, bool> && !IsSame<DecodedType, bool>) { + return DecodeError::NonConformingType; + } else { + auto&& value = value_or_error.value(); + if constexpr (requires { ValueType { value }; }) + return ValueType { value }; + } return DecodeError::NonConformingType; } |