From ae491717558b5d218faedbbff9353df59b2269af Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Sun, 18 Apr 2021 14:12:17 +0430 Subject: [PATCH] LibCrypto: Avoid creating bools from anything except bools --- Userland/Libraries/LibCrypto/ASN1/DER.h | 10 +++++++--- 1 file 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 && !IsSame) { + return DecodeError::NonConformingType; + } else { + auto&& value = value_or_error.value(); + if constexpr (requires { ValueType { value }; }) + return ValueType { value }; + } return DecodeError::NonConformingType; }