From 8d0518c2e337a6cb38cfe94ef9894cdc955de315 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Mon, 1 Apr 2024 18:06:41 +0200 Subject: [PATCH] harden against some parsing exceptions (by disabling them, since the error case is already handled) --- src/fragment_store/fragment_store.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fragment_store/fragment_store.cpp b/src/fragment_store/fragment_store.cpp index c144a32..8f5d193 100644 --- a/src/fragment_store/fragment_store.cpp +++ b/src/fragment_store/fragment_store.cpp @@ -722,7 +722,7 @@ size_t FragmentStore::scanStoragePath(std::string_view path) { file.read(reinterpret_cast(full_meta_data.data()), full_meta_data.size()); } - const auto meta_header_j = nlohmann::json::from_msgpack(full_meta_data); + const auto meta_header_j = nlohmann::json::from_msgpack(full_meta_data, true, false); if (!meta_header_j.is_array() || meta_header_j.size() < 4) { std::cerr << "FS error: broken binary meta " << it.frag_path << "\n"; @@ -780,9 +780,9 @@ size_t FragmentStore::scanStoragePath(std::string_view path) { // TODO: enc if (!meta_data_decomp.empty()) { - j = nlohmann::json::from_msgpack(meta_data_decomp); + j = nlohmann::json::from_msgpack(meta_data_decomp, true, false); } else { - j = nlohmann::json::from_msgpack(meta_data_ref); + j = nlohmann::json::from_msgpack(meta_data_ref, true, false); } } else if (it.meta_ext == ".meta.json") { std::ifstream file(it.frag_path.generic_u8string() + it.meta_ext, std::ios::in | std::ios::binary);