Universal fix for NaN and Infinity in JSON output

This commit is contained in:
XMRig 2025-06-06 14:36:21 +07:00
parent 184d6100dc
commit 682834b87d
No known key found for this signature in database
GPG key ID: 446A53638BE94409
2 changed files with 11 additions and 3 deletions

View file

@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2024 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2024 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2025 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -31,7 +31,7 @@
#include "base/tools/Chrono.h"
#include "base/tools/Cvt.h"
#include "core/config/Config.h"
#include "core/Controller.h"
#include "rapidjson/writer.h"
#include "version.h"
@ -46,6 +46,12 @@
namespace xmrig {
static_assert(
RAPIDJSON_WRITE_DEFAULT_FLAGS == (rapidjson::kWriteNanAndInfFlag | rapidjson::kWriteNanAndInfNullFlag),
"(rapidjson::kWriteNanAndInfFlag | rapidjson::kWriteNanAndInfNullFlag) required"
);
static rapidjson::Value getResources(rapidjson::Document &doc)
{
using namespace rapidjson;