代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/systemd 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 06444b314b863facdb173f10f2d1ff11196755d2 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 26 Oct 2021 15:45:49 +0200
Subject: [PATCH] json: do something remotely reasonable when we see
NaN/infinity
JSON doesn't have NaN/infinity/-infinity concepts in the spec.
Implementations vary what they do with it. JSON5 + Python simply
generate special words "NAN" and "Inifinity" from it. Others generate
"null" for it.
At this point we never actually want to output this, so let's be
conservative and generate RFC compliant JSON, i.e. convert to null.
One day should JSON5 actually become a thing we can revisit this, but in
that case we should implement things via a flag, and only optinally
process nan/infinity/-infinity.
This patch is extremely simple: whenever accepting a
nan/infinity/-infinity from outside it converts it to NULL. I.e. we
convert on input, not output.
(cherry picked from commit 8f1daefce6e952f2fad9510e5101b5fc675d363f)
Conflict:NA
Reference:https://github.com/systemd/systemd/commit/06444b314b863facdb173f10f2d1ff11196755d2
---
src/shared/json.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/shared/json.c b/src/shared/json.c
index c52460a3ec..d72b1e3a38 100644
--- a/src/shared/json.c
+++ b/src/shared/json.c
@@ -359,6 +359,12 @@ int json_variant_new_real(JsonVariant **ret, long double d) {
}
REENABLE_WARNING;
+ /* JSON doesn't know NaN, +Infinity or -Infinity. Let's silently convert to 'null'. */
+ if (isnan(d) || isinf(d)) {
+ *ret = JSON_VARIANT_MAGIC_NULL;
+ return 0;
+ }
+
r = json_variant_new(&v, JSON_VARIANT_REAL, sizeof(d));
if (r < 0)
return r;
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。