From a504da477d64a2d0ec7593f42cb2650696370e89 Mon Sep 17 00:00:00 2001 From: John Thiltges Date: Fri, 7 Nov 2025 12:16:18 -0600 Subject: [PATCH] Fix segfault if the JSON parser cannot parse the JWKS Ensure m_cget is still valid when building the exception text with m_cget->get_url(). --- src/scitokens_internal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scitokens_internal.cpp b/src/scitokens_internal.cpp index 0b37773..32aac74 100644 --- a/src/scitokens_internal.cpp +++ b/src/scitokens_internal.cpp @@ -734,12 +734,12 @@ std::unique_ptr Validator::get_public_keys_from_web_continue( auto metadata = std::string(buffer, len); picojson::value json_obj; auto err = picojson::parse(json_obj, metadata); - status->m_cget.reset(); if (!err.empty()) { throw JsonException("JSON parse failure when downloading from the " " public key URL " + status->m_cget->get_url() + ": " + err); } + status->m_cget.reset(); auto now = std::time(NULL); // TODO: take expiration time from the cache-control header in the