third_party_ncurses/backport-fix-for-out-of-memory-condition.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

156 lines
5.7 KiB
Diff
Executable File

From 6f1b898d6bac009e629f374d552d0869670b8e6a Mon Sep 17 00:00:00 2001
From: "Thomas E. Dickey" <dickey@invisible-island.net>
Date: Sat, 24 Jun 2023 22:59:35 +0000
Subject: [PATCH] snapshot of project "ncurses", label v6_4_20230624
ncurses 6.4 - patch 20230624 - 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-20230624.patch.gz
patch by Thomas E. Dickey <dickey@invisible-island.net>
created Sun Jun 25 00:38:02 UTC 2023
Conflict:Delete unnecessary modifications and adaptation of the modification time
Reference:https://github.com/ThomasDickey/ncurses-snapshots/commit/6f1b898d6bac009e629f374d552d0869670b8e6a
---
NEWS | 5 ++++-
ncurses/tinfo/lib_setup.c | 9 ++++-----
ncurses/tinfo/lib_tparm.c | 7 ++++++-
ncurses/tty/hardscroll.c | 12 +++++++++---
4 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/NEWS b/NEWS
index 57ef74c..a57ff03 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.3732 2021/10/20 22:49:51 tom Exp $
+-- $Id: NEWS,v 1.3969 2023/06/24 22:59:35 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.
+20230624
+ + fixes for out-of-memory condition (report by "eaglegai").
+
20211021 6.3 release for upload to ftp.gnu.org
+ update release notes
+ add "ncu2openbsd" script, to illustrate how to update an OpenBSD
diff --git a/ncurses/tinfo/lib_setup.c b/ncurses/tinfo/lib_setup.c
index 0aaaa93..0ad5035 100644
--- a/ncurses/tinfo/lib_setup.c
+++ b/ncurses/tinfo/lib_setup.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2018-2020,2021 Thomas E. Dickey *
+ * Copyright 2018-2022,2023 Thomas E. Dickey *
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -49,7 +49,7 @@
#include <locale.h>
#endif
-MODULE_ID("$Id: lib_setup.c,v 1.214 2021/09/01 23:38:12 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.219 2023/06/24 13:25:14 tom Exp $")
/****************************************************************************
*
@@ -679,10 +679,9 @@ TINFO_SETUP_TERM(TERMINAL **tp,
#endif
}
myname = strdup(tname);
-
- if (strlen(myname) > MAX_NAME_SIZE) {
+ if (myname == NULL || strlen(myname) > MAX_NAME_SIZE) {
ret_error(TGETENT_ERR,
- "TERM environment must be <= %d characters.\n",
+ "TERM environment must be 1..%d characters.\n",
MAX_NAME_SIZE,
free(myname));
}
diff --git a/ncurses/tinfo/lib_tparm.c b/ncurses/tinfo/lib_tparm.c
index 72d8813..9d41b60 100644
--- a/ncurses/tinfo/lib_tparm.c
+++ b/ncurses/tinfo/lib_tparm.c
@@ -53,7 +53,7 @@
#include <ctype.h>
#include <tic.h>
-MODULE_ID("$Id: lib_tparm.c,v 1.134 2021/08/21 21:52:08 tom Exp $")
+MODULE_ID("$Id: lib_tparm.c,v 1.150 2023/06/24 16:12:52 tom Exp $")
/*
* char *
@@ -798,6 +798,11 @@ tparam_internal(TPARM_STATE *tps, const char *string, TPARM_DATA *data)
tparm_trace_call(tps, string, data);
+ if (TPS(fmt_buff) == NULL) {
+ T((T_RETURN("<null>")));
+ return NULL;
+ }
+
while ((cp - string) < (int) len2) {
if (*cp != '%') {
save_char(tps, UChar(*cp));
diff --git a/ncurses/tty/hardscroll.c b/ncurses/tty/hardscroll.c
index abb21cf..d66aa99 100644
--- a/ncurses/tty/hardscroll.c
+++ b/ncurses/tty/hardscroll.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2020 Thomas E. Dickey *
+ * Copyright 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 *
@@ -148,7 +148,7 @@ AUTHOR
#include <curses.priv.h>
-MODULE_ID("$Id: hardscroll.c,v 1.54 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: hardscroll.c,v 1.56 2023/06/24 22:55:24 tom Exp $")
#if defined(SCROLLDEBUG) || defined(HASHDEBUG)
@@ -204,13 +204,19 @@ NCURSES_SP_NAME(_nc_scroll_optimize) (NCURSES_SP_DCL0)
int *new_oldnums = typeRealloc(int,
(size_t) need_lines,
oldnums(SP_PARM));
- if (!new_oldnums)
+ if (!new_oldnums) {
+ TR(TRACE_ICALLS, (T_RETURN("")));
return;
+ }
oldnums(SP_PARM) = new_oldnums;
OLDNUM_SIZE(SP_PARM) = need_lines;
}
/* calculate the indices */
NCURSES_SP_NAME(_nc_hash_map) (NCURSES_SP_ARG);
+ if (SP_PARM->hashtab_len < screen_lines(SP_PARM)) {
+ TR(TRACE_ICALLS, (T_RETURN("")));
+ return;
+ }
#endif
#endif /* !defined(SCROLLDEBUG) && !defined(HASHDEBUG) */
--
2.33.0