代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/coreutils 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 604f8a6c4d58a646c8722fdf7cad9ee67479d8f7 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Mon, 31 Jan 2022 10:20:21 -0800
Subject: [PATCH] dd: do not access uninitialized
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* src/dd.c (parse_integer): Avoid undefined behavior
that accesses an uninitialized ‘n’ when e == LONGINT_INVALID.
Return more-accurate error code when INTMAX_MAX < n.
---
src/dd.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/dd.c b/src/dd.c
index e55f87f149..7360a49738 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -1427,8 +1427,10 @@ static intmax_t
parse_integer (char const *str, strtol_error *invalid)
{
/* Call xstrtoumax, not xstrtoimax, since we don't want to
- allow strings like " -0". */
- uintmax_t n;
+ allow strings like " -0". Initialize N to an interminate value;
+ calling code should not rely on this function returning 0
+ when *INVALID represents a non-overflow error. */
+ uintmax_t n = 0;
char *suffix;
strtol_error e = xstrtoumax (str, &suffix, 10, &n, "bcEGkKMPTwYZ0");
@@ -1468,7 +1470,7 @@ parse_integer (char const *str, strtol_error *invalid)
if (INTMAX_MAX < n)
{
- *invalid = LONGINT_OVERFLOW;
+ *invalid = e | LONGINT_OVERFLOW;
return INTMAX_MAX;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。