]> ncurses.scripts.mit.edu Git - ncurses.git/commitdiff
ncurses 6.4 - patch 20230615
authorThomas E. Dickey <dickey@invisible-island.net>
Thu, 15 Jun 2023 21:24:29 +0000 (21:24 +0000)
committerThomas E. Dickey <dickey@invisible-island.net>
Thu, 15 Jun 2023 21:24:29 +0000 (21:24 +0000)
+ modify _nc_read_file_entry() to show relevant filename in warnings.
+ improve checks in convert_string() for corrupt terminfo entry (report
  and test-case by Gregory James Duck).

12 files changed:
NEWS
VERSION
dist.mk
ncurses/tinfo/comp_error.c
ncurses/tinfo/read_entry.c
package/debian-mingw/changelog
package/debian-mingw64/changelog
package/debian/changelog
package/mingw-ncurses.nsi
package/mingw-ncurses.spec
package/ncurses.spec
package/ncursest.spec

diff --git a/NEWS b/NEWS
index 6ee80b4a237952247dd6a18053de18e9f7ceaf1a..0021d964d7590610fdbbffc149811e170afea81b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -26,7 +26,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: NEWS,v 1.3962 2023/06/10 16:51:20 tom Exp $
+-- $Id: NEWS,v 1.3964 2023/06/15 11:35:35 tom Exp $
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
@@ -46,6 +46,11 @@ 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.
 
+20230615
+       + modify _nc_read_file_entry() to show relevant filename in warnings.
+       + improve checks in convert_string() for corrupt terminfo entry (report
+         and test-case by Gregory James Duck).
+
 20230610
        + improve manpages discussing file descriptors in low-level functions.
        + modify flushinp to use file descriptors in SCREEN, rather than from
diff --git a/VERSION b/VERSION
index fe6dfafea0cf0b18055b6b61110e01c86cbaaf02..65c2d0738e22cf600cc926a1baae1a83405d931d 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-5:0:10 6.4     20230610
+5:0:10 6.4     20230615
diff --git a/dist.mk b/dist.mk
index 9cee1be5d9abdbae86a6df358271838db0ccd483..9d44257ce500ceaaa6bc7af580e6c22ab39c1c2a 100644 (file)
--- a/dist.mk
+++ b/dist.mk
@@ -26,7 +26,7 @@
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
-# $Id: dist.mk,v 1.1548 2023/06/10 10:03:51 tom Exp $
+# $Id: dist.mk,v 1.1549 2023/06/15 11:23:36 tom Exp $
 # Makefile for creating ncurses distributions.
 #
 # This only needs to be used directly as a makefile by developers, but
@@ -38,7 +38,7 @@ SHELL = /bin/sh
 # These define the major/minor/patch versions of ncurses.
 NCURSES_MAJOR = 6
 NCURSES_MINOR = 4
-NCURSES_PATCH = 20230610
+NCURSES_PATCH = 20230615
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
index aa745a6dfe94b60adf7706dd484f94daeb41c6bb..3e6b4022a74b37b5668f10ae492cc20a06c0d0a5 100644 (file)
@@ -42,7 +42,7 @@
 
 #include <tic.h>
 
-MODULE_ID("$Id: comp_error.c,v 1.42 2023/04/17 08:14:39 tom Exp $")
+MODULE_ID("$Id: comp_error.c,v 1.44 2023/06/15 20:27:02 tom Exp $")
 
 NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings = FALSE;
 NCURSES_EXPORT_VAR(int) _nc_curr_line = 0; /* current line # in input */
@@ -60,8 +60,15 @@ _nc_get_source(void)
 NCURSES_EXPORT(void)
 _nc_set_source(const char *const name)
 {
-    FreeIfNeeded(SourceName);
-    SourceName = strdup(name);
+    if (name == NULL) {
+       free(SourceName);
+       SourceName = NULL;
+    } else if (SourceName == NULL) {
+       SourceName = strdup(name);
+    } else if (strcmp(name, SourceName)) {
+       free(SourceName);
+       SourceName = strdup(name);
+    }
 }
 
 NCURSES_EXPORT(void)
@@ -95,9 +102,9 @@ static NCURSES_INLINE void
 where_is_problem(void)
 {
     fprintf(stderr, "\"%s\"", SourceName ? SourceName : "?");
-    if (_nc_curr_line >= 0)
+    if (_nc_curr_line > 0)
        fprintf(stderr, ", line %d", _nc_curr_line);
-    if (_nc_curr_col >= 0)
+    if (_nc_curr_col > 0)
        fprintf(stderr, ", col %d", _nc_curr_col);
     if (TermType != 0 && TermType[0] != '\0')
        fprintf(stderr, ", terminal '%s'", TermType);
index 87e422aeec648bf52b78c7c528ec34441acbe5ec..762c6c68c18b5b7af2d6b23555bec23c4408929b 100644 (file)
@@ -42,7 +42,7 @@
 
 #include <tic.h>
 
-MODULE_ID("$Id: read_entry.c,v 1.166 2023/04/22 15:11:52 tom Exp $")
+MODULE_ID("$Id: read_entry.c,v 1.169 2023/06/15 20:51:06 tom Exp $")
 
 #define MyNumber(n) (short) LOW_MSB(n)
 
@@ -138,12 +138,13 @@ convert_16bits(char *buf, NCURSES_INT2 *Numbers, int count)
 }
 #endif
 
-static void
-convert_strings(char *buf, char **Strings, int count, int size, char *table)
+static bool
+convert_strings(char *buf, char **Strings, int count, int size,
+               char *table, bool always)
 {
     int i;
     char *p;
-    bool corrupt = FALSE;
+    bool success = TRUE;
 
     for (i = 0; i < count; i++) {
        if (IS_NEG1(buf + 2 * i)) {
@@ -159,13 +160,10 @@ convert_strings(char *buf, char **Strings, int count, int size, char *table)
                TR(TRACE_DATABASE, ("Strings[%d] = %s", i,
                                    _nc_visbuf(Strings[i])));
            } else {
-               if (!corrupt) {
-                   corrupt = TRUE;
-                   TR(TRACE_DATABASE,
-                      ("ignore out-of-range index %d to Strings[]", nn));
-                   _nc_warning("corrupt data found in convert_strings");
-               }
-               Strings[i] = ABSENT_STRING;
+               TR(TRACE_DATABASE,
+                  ("found out-of-range index %d to Strings[%d]", nn, i));
+               success = FALSE;
+               break;
            }
        }
 
@@ -175,10 +173,25 @@ convert_strings(char *buf, char **Strings, int count, int size, char *table)
                if (*p == '\0')
                    break;
            /* if there is no NUL, ignore the string */
-           if (p >= table + size)
+           if (p >= table + size) {
                Strings[i] = ABSENT_STRING;
+           } else if (p == Strings[i] && always) {
+               TR(TRACE_DATABASE,
+                  ("found empty but required Strings[%d]", i));
+               success = FALSE;
+               break;
+           }
+       } else if (always) {    /* names are always needed */
+           TR(TRACE_DATABASE,
+              ("found invalid but required Strings[%d]", i));
+           success = FALSE;
+           break;
        }
     }
+    if (!success) {
+       _nc_warning("corrupt data found in convert_strings");
+    }
+    return success;
 }
 
 static int
@@ -382,7 +395,10 @@ _nc_read_termtype(TERMTYPE2 *ptr, char *buffer, int limit)
        if (Read(string_table, (unsigned) str_size) != str_size) {
            returnDB(TGETENT_NO);
        }
-       convert_strings(buf, ptr->Strings, str_count, str_size, string_table);
+       if (!convert_strings(buf, ptr->Strings, str_count, str_size,
+                            string_table, FALSE)) {
+           returnDB(TGETENT_NO);
+       }
     }
 #if NCURSES_XNAMES
 
@@ -483,8 +499,10 @@ _nc_read_termtype(TERMTYPE2 *ptr, char *buffer, int limit)
               ("Before computing extended-string capabilities "
                "str_count=%d, ext_str_count=%d",
                str_count, ext_str_count));
-           convert_strings(buf, ptr->Strings + str_count, ext_str_count,
-                           ext_str_limit, ptr->ext_str_table);
+           if (!convert_strings(buf, ptr->Strings + str_count, ext_str_count,
+                                ext_str_limit, ptr->ext_str_table, FALSE)) {
+               returnDB(TGETENT_NO);
+           }
            for (i = ext_str_count - 1; i >= 0; i--) {
                TR(TRACE_DATABASE, ("MOVE from [%d:%d] %s",
                                    i, i + str_count,
@@ -516,10 +534,13 @@ _nc_read_termtype(TERMTYPE2 *ptr, char *buffer, int limit)
            TR(TRACE_DATABASE,
               ("ext_NAMES starting @%d in extended_strings, first = %s",
                base, _nc_visbuf(ptr->ext_str_table + base)));
-           convert_strings(buf + (2 * ext_str_count),
-                           ptr->ext_Names,
-                           (int) need,
-                           ext_str_limit, ptr->ext_str_table + base);
+           if (!convert_strings(buf + (2 * ext_str_count),
+                                ptr->ext_Names,
+                                (int) need,
+                                ext_str_limit, ptr->ext_str_table + base,
+                                TRUE)) {
+               returnDB(TGETENT_NO);
+           }
        }
 
        TR(TRACE_DATABASE,
@@ -572,13 +593,17 @@ _nc_read_file_entry(const char *const filename, TERMTYPE2 *ptr)
        int limit;
        char buffer[MAX_ENTRY_SIZE + 1];
 
-       if ((limit = (int) fread(buffer, sizeof(char), sizeof(buffer), fp))
-           > 0) {
+       limit = (int) fread(buffer, sizeof(char), sizeof(buffer), fp);
+       if (limit > 0) {
+           const char *old_source = _nc_get_source();
 
            TR(TRACE_DATABASE, ("read terminfo %s", filename));
+           if (old_source == NULL)
+               _nc_set_source(filename);
            if ((code = _nc_read_termtype(ptr, buffer, limit)) == TGETENT_NO) {
                _nc_free_termtype2(ptr);
            }
+           _nc_set_source(old_source);
        } else {
            code = TGETENT_NO;
        }
index 8dd20d7f6d6c7bd8b445e855de0aecc8ec5a06d9..fc6b76783e59d0a55a6a87ad9effa65350717dfc 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.4+20230610) unstable; urgency=low
+ncurses6 (6.4+20230615) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Tue, 06 Jun 2023 18:27:59 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Thu, 15 Jun 2023 07:23:36 -0400
 
 ncurses6 (5.9+20131005) unstable; urgency=low
 
index 8dd20d7f6d6c7bd8b445e855de0aecc8ec5a06d9..fc6b76783e59d0a55a6a87ad9effa65350717dfc 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.4+20230610) unstable; urgency=low
+ncurses6 (6.4+20230615) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Tue, 06 Jun 2023 18:27:59 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Thu, 15 Jun 2023 07:23:36 -0400
 
 ncurses6 (5.9+20131005) unstable; urgency=low
 
index 4fc5790429440b41b7d6ed8cafbb2ce0a4daebcc..6a67c0c4c99752f4952831d2b052c1fcc39c8a6b 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.4+20230610) unstable; urgency=low
+ncurses6 (6.4+20230615) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Tue, 06 Jun 2023 18:27:59 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Thu, 15 Jun 2023 07:23:36 -0400
 
 ncurses6 (5.9+20120608) unstable; urgency=low
 
index 8768225abfd4413a334e0f90f556959fc16506a0..08074018b88fd92ab0de4cb92da5d5593fe3dffd 100644 (file)
@@ -1,4 +1,4 @@
-; $Id: mingw-ncurses.nsi,v 1.588 2023/06/06 22:27:59 tom Exp $\r
+; $Id: mingw-ncurses.nsi,v 1.589 2023/06/15 11:23:36 tom Exp $\r
 \r
 ; TODO add examples\r
 ; TODO bump ABI to 6\r
@@ -10,7 +10,7 @@
 !define VERSION_MAJOR "6"\r
 !define VERSION_MINOR "4"\r
 !define VERSION_YYYY  "2023"\r
-!define VERSION_MMDD  "0610"\r
+!define VERSION_MMDD  "0615"\r
 !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}\r
 \r
 !define MY_ABI   "5"\r
index 0ec2381939285e7140a954c7d6130dcb2292ef62..8872a0454194d220d198f5faf1332af23632fcbe 100644 (file)
@@ -3,7 +3,7 @@
 Summary: shared libraries for terminal handling
 Name: mingw32-ncurses6
 Version: 6.4
-Release: 20230610
+Release: 20230615
 License: X11
 Group: Development/Libraries
 URL: https://invisible-island.net/ncurses/
index 58ecf2c50edbee933dba45cbad649a9b5d4a6d2b..df3eb9f35f9555297233a81f02c5257cbf0d7014 100644 (file)
@@ -1,7 +1,7 @@
 Summary: shared libraries for terminal handling
 Name: ncurses6
 Version: 6.4
-Release: 20230610
+Release: 20230615
 License: X11
 Group: Development/Libraries
 URL: https://invisible-island.net/ncurses/
index a9d32ca7af56ec841d02a935b1dad4147e9cf875..9360fcfdfaa48907213204f7355a355484b1f9cd 100644 (file)
@@ -1,7 +1,7 @@
 Summary: Curses library with POSIX thread support.
 Name: ncursest6
 Version: 6.4
-Release: 20230610
+Release: 20230615
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz