third_party_ncurses/backport-fix-coredump-when-use-Memmove.patch
xwx1135370 6dd963a0bb [新需求]: ncurses版本切换6.3-15.oe2203sp3
issue: https://gitee.com/openharmony/third_party_ncurses/issues/I9J2H6?from=project-issue

Test: LLVM Toolchain Compilation and LLDB Tool test

Signed-off-by: xwx1135370 <xuyao44@huawei.com>
2024-05-04 09:38:10 +08:00

91 lines
3.5 KiB
Diff
Executable File

From 8884a7e908ffc6e8a0b6bcbca5832fe3fc579343 Mon Sep 17 00:00:00 2001
From: "Thomas E. Dickey" <dickey@invisible-island.net>
Date: Sun, 25 Jun 2023 18:16:49 +0000
Subject: [PATCH] snapshot of project "ncurses", label v6_4_20230625
ncurses 6.4 - patch 20230625 - Thomas E. Dickey
------------------------------------------------------------------------------
Ncurses 6.4 is at
https://invisible-island.net/archives/ncurses/
https://invisible-mirror.net/archives/ncurses/
https://ftp.gnu.org/gnu/ncurses/
Patches for ncurses 6.4 can be found at
https://invisible-island.net/archives/ncurses/6.4
https://invisible-mirror.net/archives/ncurses/6.4
------------------------------------------------------------------------------
https://invisible-island.net/archives/ncurses/6.4/ncurses-6.4-20230625.patch.gz
patch by Thomas E. Dickey <dickey@invisible-island.net>
created Sun Jun 25 23:46:35 UTC 2023
Conflict:Delete unnecessary modifications
Reference:https://github.com/ThomasDickey/ncurses-snapshots/commit/8884a7e908ffc6e8a0b6bcbca5832fe3fc579343
---
NEWS | 5 ++++-
ncurses/tty/hashmap.c | 9 ++++++---
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/NEWS b/NEWS
index a57ff03..b49ff26 100644
--- a/NEWS
+++ b/NEWS
@@ -26,7 +26,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: NEWS,v 1.3969 2023/06/24 22:59:35 tom Exp $
+-- $Id: NEWS,v 1.3971 2023/06/25 18:16:49 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
@@ -46,6 +46,9 @@ See the AUTHORS file for the corresponding full names.
Changes through 1.9.9e did not credit all contributions;
it is not possible to add this information.
+20230625
+ + fixes for out-of-memory condition (report by "eaglegai").
+
20230624
+ fixes for out-of-memory condition (report by "eaglegai").
diff --git a/ncurses/tty/hashmap.c b/ncurses/tty/hashmap.c
index 3f124c9..2ddfaaa 100644
--- a/ncurses/tty/hashmap.c
+++ b/ncurses/tty/hashmap.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2019,2020 Thomas E. Dickey *
+ * Copyright 2019-2020,2023 Thomas E. Dickey *
* Copyright 1998-2015,2016 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -74,7 +74,7 @@ AUTHOR
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: hashmap.c,v 1.69 2020/05/31 17:50:48 tom Exp $")
+MODULE_ID("$Id: hashmap.c,v 1.70 2023/06/25 17:16:01 tom Exp $")
#ifdef HASHDEBUG
@@ -318,8 +318,11 @@ NCURSES_SP_NAME(_nc_hash_map) (NCURSES_SP_DCL0)
if (newhash(SP_PARM) == 0)
newhash(SP_PARM) = typeCalloc(unsigned long,
(size_t) screen_lines(SP_PARM));
- if (!oldhash(SP_PARM) || !newhash(SP_PARM))
+ if (!oldhash(SP_PARM) || !newhash(SP_PARM)) {
+ FreeAndNull(oldhash(SP_PARM));
+ FreeAndNull(newhash(SP_PARM));
return; /* malloc failure */
+ }
for (i = 0; i < screen_lines(SP_PARM); i++) {
newhash(SP_PARM)[i] = hash(SP_PARM, NEWTEXT(SP_PARM, i));
oldhash(SP_PARM)[i] = hash(SP_PARM, OLDTEXT(SP_PARM, i));
--
2.33.0