From 7a77130923d2246e5b304b107b549388d1f93a0c Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Sun, 9 Jun 2024 12:27:03 +1200 Subject: [PATCH] LibWeb: Do not release_value twice parsing a referrer policy This fixes a bug introduced in ab6b687d4c which was causing many live sites (such as chat.openai.com and github.com/serenityos/serenity) to crash. --- Userland/Libraries/LibWeb/ReferrerPolicy/AbstractOperations.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/ReferrerPolicy/AbstractOperations.cpp b/Userland/Libraries/LibWeb/ReferrerPolicy/AbstractOperations.cpp index 2dbb14ff9bc..8d9e7ac8293 100644 --- a/Userland/Libraries/LibWeb/ReferrerPolicy/AbstractOperations.cpp +++ b/Userland/Libraries/LibWeb/ReferrerPolicy/AbstractOperations.cpp @@ -30,7 +30,7 @@ ReferrerPolicy parse_a_referrer_policy_from_a_referrer_policy_header(Fetch::Infr // 3. For each token in policy-tokens, if token is a referrer policy and token is not the empty string, then set policy to token. for (auto token : policy_tokens) { auto referrer_policy = from_string(token); - if (referrer_policy.has_value() && referrer_policy.release_value() != ReferrerPolicy::EmptyString) + if (referrer_policy.has_value() && referrer_policy.value() != ReferrerPolicy::EmptyString) policy = referrer_policy.release_value(); }